Ejemplo n.º 1
0
        /// <summary>
        /// Sends command to arduino to change color value
        /// </summary>
        /// <param name="color">Color to be altered</param>
        /// <param name="value">New value, should be between 0 and 255</param>
        public void UpdateColorValue(Colors color, double value)
        {
            string[] portlist = SerialPort.GetPortNames();

            foreach (String s in portlist)
            {
                try
                {
                    if (_port == null || !_port.IsOpen)
                    {
                        _port = new SerialPort(s, 9600, Parity.None, 8, StopBits.One);
                        _port.DataReceived += OnReceived;

                        _port.Open();
                    }

                    // Todo: Before sending data, we should do some sort of handshake to make sure it's actually the our program

                    string toSend = string.Format("{0};{1}",
                        (char)((int)color),
                        ((int)value).ToString()
                    );

                    // Serialze the data for transmission
                    byte[] data = CommandMessage(toSend);
                    _port.Write(data, 0, data.Length);
                }
                catch (Exception ex)
                {
                    // todo error handling
                }
            }
        }
    public void hitColoredBuilding(Colors color)
    {
        //Debug.Log (color + " hit me");
        if (color == getColorNeeded()) {
            // check box and move on
            //   if box is last in combo, move multiplier up and start new combo

            stars[onBoxNumber].GetComponent<Image>().enabled = true;
            onBoxNumber++;

            if (onBoxNumber == comboSetAmount) {
                // combo completed
                comboCompleted(comboSetAmount);
            }
        } else {
            // if current box is first move multiplier down, if not reset combo
            if (onBoxNumber == 0) {
                // delevel
                deMultiply();
            } else {
                // reset combo
                resetCombo();
            }
        }
    }
Ejemplo n.º 3
0
        public override void Calculate(int index)
        {
            int nuBar = MarketSeries.Close.Count - 1;
            double c = MarketSeries.Close[index] / Symbol.PipSize;
            double nu = (c - (c % pips)) * Symbol.PipSize;

            if (nu > vorige)
            {
                // stijging van minimaal pips
                rUP[index] = nu;
                rDOWN[index] = nu - (pips * Symbol.PipSize);
                vvorig(nu, nuBar);
            }
            else if (nu < vorige)
            {
                // daling van minimaal pips
                rUP[index] = nu + (pips * Symbol.PipSize);
                rDOWN[index] = nu;
                kleur = Colors.Tomato;
                vvorig(nu, nuBar);
            }
            else
            {
                // zelfde
                rUP[index] = rUP[index - 1];
                rDOWN[index] = rDOWN[index - 1];
            }
        }
Ejemplo n.º 4
0
        public void WriteTo(Colors colors)
        {
            colors.FrameForeground = FrameForeground;
            colors.FrameBackground = FrameBackground;
            colors.FrameSecondary = FrameSecondary;

            colors.ContentForeground = ContentForeground;
            colors.ContentBackground = ContentBackground;
            colors.ContentSecondary = ContentSecondary;
            colors.ContentPopout = ContentPopout;
            colors.ContentEnabled = ContentEnabled;
            colors.ContentDisabled = ContentDisabled;

            colors.ContactListBackground = ContactListBackground;
            colors.ContactListForeground = ContactListForeground;
            colors.ContactListSelected = ContactListSelected;

            colors.HighlightForeground = HighlightForeground;
            colors.HighlightImportant = HighlightImportant;
            colors.HighlightWarning = HighlightWarning;
            colors.HighlightRequest = HighlightRequest;

            colors.StatusAvailable = StatusAvailable;
            colors.StatusAway = StatusAway;
            colors.StatusDnd = StatusDnd;
            colors.StatusOffline = StatusOffline;
        }
Ejemplo n.º 5
0
        public void ReadFrom(Colors colors)
        {
            if (colors == null)
                return;

            FrameForeground = colors.FrameForeground;
            FrameBackground = colors.FrameBackground;
            FrameSecondary = colors.FrameSecondary;

            ContentForeground = colors.ContentForeground;
            ContentBackground = colors.ContentBackground;
            ContentSecondary = colors.ContentSecondary;
            ContentPopout = colors.ContentPopout;
            ContentEnabled = colors.ContentEnabled;
            ContentDisabled = colors.ContentDisabled;

            ContactListBackground = colors.ContactListBackground;
            ContactListForeground = colors.ContactListForeground;
            ContactListSelected = colors.ContactListSelected;

            HighlightForeground = colors.HighlightForeground;
            HighlightImportant = colors.HighlightImportant;
            HighlightWarning = colors.HighlightWarning;
            HighlightRequest = colors.HighlightRequest;

            StatusAvailable = colors.StatusAvailable;
            StatusAway = colors.StatusAway;
            StatusDnd = colors.StatusDnd;
            StatusOffline = colors.StatusOffline;
        }
        public override void Calculate(int index)
        {
            if (_incorrectColors)
            {
                var errorColor = _random.Next(2) == 0 ? Colors.Red : Colors.White;
                ChartObjects.DrawText("Error", "Incorrect colors", StaticPosition.Center, errorColor);
                return;
            }

            var open = MarketSeries.Open[index];
            var high = MarketSeries.High[index];
            var low = MarketSeries.Low[index];
            var close = MarketSeries.Close[index];

            var MA = _ma.Result[index];
            MaResult[index] = MA;

            if (MA < close)
                color = open > close ? _AboveDownColor : _AboveUpColor;

            if (MA >= close)
                color = open > close ? _BelowDownColor : _BelowUpColor;

            ChartObjects.DrawLine("candle" + index, index, open, index, close, color, CandleWidth, LineStyle.Solid);
            ChartObjects.DrawLine("line" + index, index, high, index, low, color, WickWidth, LineStyle.Solid);



        }
        private String getColorBinKey(int color, Colors type)
        {
            int bin = color / 25;
            String key;
            if (type == Colors.R) {
                key = "R";
            }
            else if (type == Colors.G)
            {
                key = "G";
            }
            else if (type == Colors.B)
            {
                key = "B";
            }
            else {
                return null;
            }

            if (color < 250)
            {
                return key + bin.ToString();
            }
            else {
                return key + "9";
            }
        }
Ejemplo n.º 8
0
        public static void SetStatus(string text, Colors color)
        {
            try
            {
                Bitmap theColor = new Bitmap(P2PVpn.Properties.Resources.Stop_red2);
                if (color == Colors.Green)
                {
                    theColor = P2PVpn.Properties.Resources.Accept2;
                }
                else if (color == Colors.Red)
                {
                    theColor = P2PVpn.Properties.Resources.Stop_red2;
                }
                else if (color == Colors.Yellow)
                {
                    theColor = P2PVpn.Properties.Resources.Prohibit2;
                }
                if (_statusBar.InvokeRequired)
                {
                    _statusBar.BeginInvoke(new Action(() => _lblStatusText.Text = text));
                    _statusBar.BeginInvoke(new Action(() => _lblStatusText.Image = theColor));

                }
                else
                {
                    _lblStatusText.Text = text;
                    _lblStatusText.Image = theColor;
                }

            }
            catch (ObjectDisposedException ex)
            {

            }
        }
Ejemplo n.º 9
0
        public Nest(Colors color, Piece[] pieces)
        {
            this.pieces = new Stack<Piece>();
            this.color = color;

            foreach (var piece in pieces)
            {  pushPiece(piece); }
        }
Ejemplo n.º 10
0
 public Piece(Colors color, int ID)
 {
     Color = color;
     PieceID = ID;
     Alive = true;
     Active = false;
     Steps = 0;
     Position = -1;
 }
 /// <summary>
 /// �F���w��� LED ��_������
 /// </summary>
 /// <param name="color"></param>
 public void SetColor(Colors color)
 {
     int redFlag = (int)color & (int)Colors.Red;
     int greenFlag = (int)color & (int)Colors.Green;
     int blueFlag = (int)color & (int)Colors.Blue;
     portRed.Write(redFlag != 0);
     portGreen.Write(greenFlag != 0);
     portBlue.Write(blueFlag != 0);
 }
Ejemplo n.º 12
0
        public override void Calculate(int index)
        {

            LineBold = L1;

            if (SetBlue)
            {
                LineColor = Colors.DodgerBlue;
            }


            if (SetRed)
            {
                LineColor = Colors.Red;
            }
            if (SetWhite)
            {
                LineColor = Colors.White;
            }
            if (SetBlack)
            {
                LineColor = Colors.Black;
            }
            if (SetGreen)
            {
                LineColor = Colors.YellowGreen;
            }


            if (Set100Levels && MinLevel < MaxLevel)
            {
                for (int i = MinLevel; i < MaxLevel; i++)
                {
                    ChartObjects.DrawHorizontalLine("Level" + i, i * 100 * Symbol.PipSize, LineColor, LineBold, LineStyle.Solid);
                }
            }

            if (Set25Levels && MinLevel < MaxLevel)
            {
                for (int i = MinLevel; i < MaxLevel; i++)
                {
                    ChartObjects.DrawHorizontalLine("Lh1" + i, i * 100 * Symbol.PipSize + 25 * Symbol.PipSize, Colors.Red, 1, LineStyle.DotsRare);
                    ChartObjects.DrawHorizontalLine("Lh3" + i, i * 100 * Symbol.PipSize + 75 * Symbol.PipSize, Colors.Red, 1, LineStyle.DotsRare);
                }
            }

            if (Set50Levels && MinLevel < MaxLevel)
            {
                for (int i = MinLevel; i < MaxLevel; i++)
                {
                    ChartObjects.DrawHorizontalLine("Lh2" + i, i * 100 * Symbol.PipSize + 50 * Symbol.PipSize, Colors.YellowGreen, 1, LineStyle.Lines);
                }
            }



        }
Ejemplo n.º 13
0
 public Color GetExclusionRandomColor(Colors excColor, out Colors color)
 {
     int index = getRandomColorIndex();
     while ((Colors)index == excColor)
     {
         index = getRandomColorIndex();
     }
     color = (Colors)index;
     return colors[index];
 }
Ejemplo n.º 14
0
 	public void OnClick() {
		int color = (int)ObjectColor;
		color++;
		if (color > (int)Colors.Blue) {
			color = (int)Colors.Red;
		}
		
		ObjectColor = ( Colors )color;
		renderer.sharedMaterial = SaveStateSample.instance.Materials[ ( int )ObjectColor ];
	}
Ejemplo n.º 15
0
		public Player (string name, Colors color)
		{
			Name = name;

			Color = color;

			MoveLimit = (Color == Colors.Black) ? 0 : 9;

			Direction = (Color == Colors.Black) ? 1 : -1;
		}
Ejemplo n.º 16
0
 public string InsertColor(string name)
 {
     Colors c = new Colors();
     c.ColorName = name;
     bool rs = cd.InsertColor(c);
     string s = "New row has been added";
     if (!rs)
         s = "Adding failed";
     return s;
 }
Ejemplo n.º 17
0
 public SaveFile(Lingo lingoGame, WordManager wordManager, Colors[] result,
     Colors[] foundLetters, Colors[,] earlierResult, String[,] earlierLetters)
 {
     this.lingoGame = lingoGame;
     this.wordManager = wordManager;
     this.result = result;
     this.foundLetters = foundLetters;
     this.earlierLetters = earlierLetters;
     this.earlierResult = earlierResult;
 }
Ejemplo n.º 18
0
 internal static void ResolveColors()
 {
     if (isProSkin)
     {
         colors = new DarkColors();
     }
     else
     {
         colors = new LightColors();
     }
 }
Ejemplo n.º 19
0
        public short BestMoveForColor(System.Collections.BitArray possibleMoves, Colors color, Board.Board board)
        {
            List<int> boardMoveLocations = new List<int>();

            for (int i=0; i<possibleMoves.Count; i++)
            {
                if (possibleMoves[i]) { boardMoveLocations.Add(i); }
            }
            Random r = new Random();
            int randomIndex = r.Next() % (boardMoveLocations.Count - 1);
            return (short)boardMoveLocations[randomIndex];
        }
Ejemplo n.º 20
0
        protected override void Initialize()
        {
            try
            {
                // Get the 1 min timeframe series of data
                minuteSeries = MarketData.GetSeries(Symbol, TimeFrame.Minute);
                warningTextColor = (Colors)Enum.Parse(typeof(Colors), WarningColor, true);
                spreadTextColor = (Colors)Enum.Parse(typeof(Colors), SpreadColor, true);
            } catch (Exception e)
            {
                errorOccured = true;
                Print("Scalpers Buddy: " + e.Message);
            }

            // position alert message on screen
            switch (WarningPostion)
            {
                case 1:
                    position = StaticPosition.TopLeft;
                    break;
                case 2:
                    position = StaticPosition.TopCenter;
                    break;
                case 3:
                    position = StaticPosition.TopRight;
                    //lowerPosition = "\n\n";
                    break;
                case 4:
                    position = StaticPosition.Right;
                    lowerPosition = "\n\n";
                    break;
                case 5:
                    position = StaticPosition.BottomRight;
                    lowerPosition = "\n\n";
                    break;
                case 6:
                    position = StaticPosition.BottomCenter;
                    lowerPosition = "\n\n";
                    break;
                case 7:
                    position = StaticPosition.BottomLeft;
                    lowerPosition = "\n\n";
                    break;
                case 8:
                    position = StaticPosition.Left;
                    lowerPosition = "\n\n";
                    break;
                default:
                    position = StaticPosition.TopLeft;
                    break;
            }
        }
Ejemplo n.º 21
0
    public void NextWord(string Txt)
    {
        if 		(Txt.Equals ("Red")   ) colorText = Colors.Red   ;
        else if (Txt.Equals ("Blue")  ) colorText = Colors.Blue  ;
        else if (Txt.Equals ("Yellow")) colorText = Colors.Yellow;
        else if (Txt.Equals ("Cyan")  ) colorText = Colors.Cyan  ;
        else if (Txt.Equals ("Purple")) colorText = Colors.Purple;
        else if (Txt.Equals ("Green") ) colorText = Colors.Green ;
        else Debug.Log("WTF");

        forcedColor = true;
        randomColour();
    }
Ejemplo n.º 22
0
        protected override void Initialize()
        {
            if (!Enum.TryParse(color_label_str, out color_label))
                color_label = Colors.Lime;

            if (!Enum.TryParse(color_value_str, out color_value))
                color_value = Colors.White;

            if (timeframe_daily)
                mseries = MarketData.GetSeries(TimeFrame.Daily);
            else
                mseries = MarketSeries;
        }
Ejemplo n.º 23
0
        public bool Set(Colors color)
        {
            if (this.device == null)
              {
            throw new InvalidOperationException("Not initialized");
              }
              else
              {
            this.logger.Debug("Set color: {0}", color);

            return this.device.AllLeds.SetColor(this.colorsMapping[color]).Wait(Timeout);
              }
        }
 public RtfStyle(HorizontalAlignment itsAlignment, int itsIndent, 
     Font itsFont, Color itsColor, bool itsBullet, Color itsBackColor)
 {
     ItsAlignment = itsAlignment;
     ItsIndent = itsIndent;
     ItsFont = itsFont;
     ItsColor = itsColor;
     ItsBullet = itsBullet;
     ItsBackColor = itsBackColor;
     _itsFontColors = new Colors();
     ItsFontColors.ForeColor = ItsColor;
     ItsFontColors.BackgroundColor = itsBackColor;
 }
Ejemplo n.º 25
0
 public bool InsertColor(Colors c)
 {
     SqlConnection sqlConn = new SqlConnection(connectionString);
     sqlConn.Open();
     string sqlInsert = "insert into colors values(@colorName)";
     SqlCommand sqlCmdInsert = new SqlCommand(sqlInsert, sqlConn);
     sqlCmdInsert.Parameters.AddWithValue("@colorName", c.ColorName);
     int i = sqlCmdInsert.ExecuteNonQuery();
     sqlConn.Close();
     if (i != 0)
         return true;
     else
         return false;
 }
        private void btn_Ok_Click(object sender, EventArgs e)
        {
            if (
                txt_Name1.Text == ""
                || txt_Name2.Text == ""
                || txt_Name3.Text == ""
                || (txt_Name4.Text == "" && NumPlayers > 3)
                || cbox_Color1.SelectedItem.ToString() == Resources.None
                || cbox_Color2.SelectedItem.ToString() == Resources.None
                || cbox_Color3.SelectedItem.ToString() == Resources.None
                || (cbox_Color4.SelectedItem.ToString() == Resources.None && NumPlayers > 3)
                )
            {
                MessageBox.Show(
                    "You have not completed all of the required fields.",
                    "Incomplete Field",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Exclamation,
                    MessageBoxDefaultButton.Button1);
                return;
            }
            else
            {
                Player1Name = txt_Name1.Text;
                Player1Color = (Colors)Enum.Parse(typeof(Colors), getColor(cbox_Color1.SelectedItem.ToString()));
                var player1 = new Player(Player1Name) {PlayerColor = Player1Color};

                Player2Name = txt_Name2.Text;
                Player2Color = (Colors) Enum.Parse(typeof (Colors), getColor(cbox_Color2.SelectedItem.ToString()));
                var player2 = new Player(Player2Name) { PlayerColor = Player2Color };

                Player3Name = txt_Name3.Text;
                Player3Color = (Colors) Enum.Parse(typeof (Colors), getColor(cbox_Color3.SelectedItem.ToString()));
                var player3 = new Player(Player3Name) { PlayerColor = Player3Color };

                var players = new List<Player> { player1, player2, player3 };

                if (NumPlayers > 3)
                {
                    Player4Name = txt_Name4.Text;
                    Player4Color = (Colors) Enum.Parse(typeof (Colors), getColor(cbox_Color4.SelectedItem.ToString()));
                    players.Add(new Player(Player4Name) { PlayerColor = Player4Color });
                }

                Controller = new GameController(players);

                this.DialogResult = DialogResult.OK;
                return;
            }
        }
Ejemplo n.º 27
0
 public static Color GetRealColor(Colors c)
 {
     switch (c)
     {
         case Colors.Red:
             return i.Red;
         case Colors.Green:
             return i.Green;
         case Colors.Blue:
             return i.Blue;
         case Colors.Yellow:
             return i.Yellow;
     }
     return Color.white;
 }
Ejemplo n.º 28
0
        public Panel(string title, PanelType? panelType = null, Colors? color = null,
			IDictionary<string, object> htmlAttributes = null)
            : base("div")
        {
            EnsureClass("panel");

            if (panelType != null)
                EnsureClass(string.Format("panel-{0}", panelType.ToName()));

            if (color != null)
                EnsureClass(string.Format("panel-{0}", color.ToName()));

            if (htmlAttributes != null)
                this.htmlAttributes = htmlAttributes;
        }
Ejemplo n.º 29
0
 internal static int ConvertToColorBits(Colors colorBits)
 {
     switch (colorBits)
     {
         case Colors.Bits8:
             return 8;
         case Colors.Bit16:
             return 16;
         case Colors.Bits24:
             return 24;
         case Colors.Bits32:
             return 32;
         default:
             return 16;
     }
 }
Ejemplo n.º 30
0
        protected override void Initialize()
        {
            // Parse color from string

            if (!Enum.TryParse(TextColor, out _colorText))
            {
                ChartObjects.DrawText("errorMsg1", "Invalid Color for Text", StaticPosition.TopLeft, Colors.Red);
                _colorText = Colors.Yellow;
            }

            if (!Enum.TryParse(LineColor, out _colorLine))
            {
                ChartObjects.DrawText("errorMsg2", "\nInvalid Color for Line", StaticPosition.TopLeft, Colors.Red);
                _colorLine = Colors.White;
            }
        }
Ejemplo n.º 31
0
 /// <summary>
 /// 新增技能:衝刺繪圖物件
 /// </summary>
 /// <param name="iconColor">繪製顏色</param>
 /// <param name="bindingSkill">綁定技能</param>
 public DrawSkillShockwave(Color iconColor, SkillBase bindingSkill = null)
 {
     Colors.SetColor("Icon", iconColor);
     Animation    = 0;
     BindingSkill = bindingSkill;
 }
Ejemplo n.º 32
0
        /// <summary>
        /// This is to draw the actual container
        /// </summary>
        /// <param name="graphics"></param>
        /// <param name="renderMode"></param>
        public override void Draw(Graphics graphics, RenderMode renderMode)
        {
            if (TargetAdorner == null)
            {
                return;
            }
            graphics.SmoothingMode      = SmoothingMode.HighQuality;
            graphics.InterpolationMode  = InterpolationMode.HighQualityBicubic;
            graphics.CompositingQuality = CompositingQuality.HighQuality;
            graphics.PixelOffsetMode    = PixelOffsetMode.None;
            graphics.TextRenderingHint  = TextRenderingHint.AntiAliasGridFit;

            Color lineColor     = GetFieldValueAsColor(FieldType.LINE_COLOR);
            Color fillColor     = GetFieldValueAsColor(FieldType.FILL_COLOR);
            bool  shadow        = GetFieldValueAsBool(FieldType.SHADOW);
            int   lineThickness = GetFieldValueAsInt(FieldType.LINE_THICKNESS);

            bool      lineVisible = lineThickness > 0 && Colors.IsVisible(lineColor);
            Rectangle rect        = GuiRectangle.GetGuiRectangle(Left, Top, Width, Height);

            if (Selected && renderMode == RenderMode.EDIT)
            {
                DrawSelectionBorder(graphics, rect);
            }

            GraphicsPath bubble = CreateBubble(lineThickness);

            GraphicsPath tail = CreateTail();

            //draw shadow first
            if (shadow && (lineVisible || Colors.IsVisible(fillColor)))
            {
                const int basealpha   = 100;
                int       alpha       = basealpha;
                const int steps       = 5;
                int       currentStep = lineVisible ? 1 : 0;
                using (Matrix shadowMatrix = new Matrix())
                    using (GraphicsPath bubbleClone = (GraphicsPath)bubble.Clone())
                        using (GraphicsPath tailClone = (GraphicsPath)tail.Clone()) {
                            shadowMatrix.Translate(1, 1);
                            while (currentStep <= steps)
                            {
                                using (Pen shadowPen = new Pen(Color.FromArgb(alpha, 100, 100, 100))) {
                                    shadowPen.Width = lineVisible ? lineThickness : 1;
                                    tailClone.Transform(shadowMatrix);
                                    graphics.DrawPath(shadowPen, tailClone);
                                    bubbleClone.Transform(shadowMatrix);
                                    graphics.DrawPath(shadowPen, bubbleClone);
                                }
                                currentStep++;
                                alpha = alpha - basealpha / steps;
                            }
                        }
            }

            GraphicsState state = graphics.Save();

            // draw the tail border where the bubble is not visible
            using (Region clipRegion = new Region(bubble)) {
                graphics.SetClip(clipRegion, CombineMode.Exclude);
                using (Pen pen = new Pen(lineColor, lineThickness)) {
                    graphics.DrawPath(pen, tail);
                }
            }
            graphics.Restore(state);

            if (Colors.IsVisible(fillColor))
            {
                //draw the bubbleshape
                state = graphics.Save();
                using (Brush brush = new SolidBrush(fillColor)) {
                    graphics.FillPath(brush, bubble);
                }
                graphics.Restore(state);
            }

            if (lineVisible)
            {
                //draw the bubble border
                state = graphics.Save();
                // Draw bubble where the Tail is not visible.
                using (Region clipRegion = new Region(tail)) {
                    graphics.SetClip(clipRegion, CombineMode.Exclude);
                    using (Pen pen = new Pen(lineColor, lineThickness)) {
                        //pen.EndCap = pen.StartCap = LineCap.Round;
                        graphics.DrawPath(pen, bubble);
                    }
                }
                graphics.Restore(state);
            }

            if (Colors.IsVisible(fillColor))
            {
                // Draw the tail border
                state = graphics.Save();
                using (Brush brush = new SolidBrush(fillColor)) {
                    graphics.FillPath(brush, tail);
                }
                graphics.Restore(state);
            }

            // cleanup the paths
            bubble.Dispose();
            tail.Dispose();

            // Draw the text
            DrawText(graphics, rect, lineThickness, lineColor, shadow, StringFormat, Text, Font);
        }
Ejemplo n.º 33
0
 public static bool Draw(GUIContent content, ColorName buttonColorName, ColorName textColorName, bool enabled, float height, float width = -1)
 {
     return(Draw(content, DEFAULT_SIZE, DEFAULT_TEXT_ALIGN, Colors.GetDColor(buttonColorName), Colors.GetDColor(textColorName), enabled, height, width));
 }
Ejemplo n.º 34
0
 public static bool Draw(Rect rect, GUIContent content, Size textSize, ColorName buttonColorName, ColorName textColorName, bool enabled)
 {
     return(Draw(rect, content, textSize, DEFAULT_TEXT_ALIGN, Colors.GetDColor(buttonColorName), Colors.GetDColor(textColorName), enabled));
 }
Ejemplo n.º 35
0
 public static bool Draw(Rect rect, string label, ColorName buttonColorName, ColorName textColorName, bool enabled)
 {
     return(Draw(rect, new GUIContent(label), DEFAULT_SIZE, DEFAULT_TEXT_ALIGN, Colors.GetDColor(buttonColorName), Colors.GetDColor(textColorName), enabled));
 }
Ejemplo n.º 36
0
        public override void PushSelectedObjectToViewer()
        {
            mSelectedObject.GetPlayerAttention = false;
            //Missions.Get.MissionStateByName (mSelectedObject.Name);
            List <string> detailText = new List <string>();

            detailText.Add(mSelectedObject.Description);

            Color missionColor = Colors.Get.MessageInfoColor;

            if (mSelectedObject.ObjectivesCompleted)
            {
                if (Flags.Check((uint)mSelectedObject.Status, (uint)MissionStatus.Failed, Flags.CheckType.MatchAny))
                {
                    missionColor = Colors.Get.MessageDangerColor;
                }
                else
                {
                    missionColor = Colors.Get.MessageSuccessColor;
                }
            }
            else
            {
                if (Flags.Check((uint)mSelectedObject.Status, (uint)MissionStatus.Failed, Flags.CheckType.MatchAny))
                {
                    missionColor = Colors.Get.MessageDangerColor;
                }
                else if (Flags.Check((uint)mSelectedObject.Status, (uint)MissionStatus.Ignored, Flags.CheckType.MatchAny))
                {
                    missionColor = Colors.Get.MessageWarningColor;
                }
            }

            detailText.Add("_");                                    //divider

            foreach (ObjectiveState objectiveToDisplay in mSelectedObject.Objectives)
            {
                if (!objectiveToDisplay.Hidden && objectiveToDisplay.Status != MissionStatus.Dormant)
                {
                    Color objectiveColor = Colors.Get.MessageInfoColor;
                    if (objectiveToDisplay.Completed)
                    {
                        //Debug.Log ("Objective " + objectiveToDisplay.Name + " is completed");
                        if (Flags.Check((uint)objectiveToDisplay.Status, (uint)MissionStatus.Failed, Flags.CheckType.MatchAny))
                        {
                            objectiveColor = Colors.Get.MessageDangerColor;
                        }
                        else
                        {
                            //Debug.Log ("I'm turning you green");
                            objectiveColor = Colors.Get.MessageSuccessColor;
                        }
                    }
                    else if (objectiveToDisplay.Status != MissionStatus.Dormant)
                    {
                        //Debug.Log ("It's not completed, but it's not dormant either");
                        if (Flags.Check((uint)objectiveToDisplay.Status, (uint)MissionStatus.Failed, Flags.CheckType.MatchAny))
                        {
                            objectiveColor = Colors.Get.MessageDangerColor;
                        }
                        else if (Flags.Check((uint)objectiveToDisplay.Status, (uint)MissionStatus.Ignored, Flags.CheckType.MatchAny))
                        {
                            objectiveColor = Colors.Get.MessageWarningColor;
                        }
                    }

                    if (objectiveToDisplay.Completed)
                    {
                        detailText.Add(Colors.ColorWrap(objectiveToDisplay.Name.ToUpper(), objectiveColor));
                    }
                    else
                    {
                        detailText.Add(Colors.ColorWrap(objectiveToDisplay.Name.ToUpper() + ": ", Color.white) + Colors.ColorWrap(objectiveToDisplay.Description, objectiveColor));
                    }
                }
            }

            string             finalDetailText = string.Join("\n", detailText.ToArray());
            FrontiersInterface user            = this;

            if (!HasFocus)
            {
                user = GUILogInterface.Get;
            }
            GUIDetailsPage.Get.DisplayDetail(
                user,
                Frontiers.Data.GameData.InterpretScripts(mSelectedObject.Title, Profile.Get.CurrentGame.Character, null),
                Frontiers.Data.GameData.InterpretScripts(finalDetailText, Profile.Get.CurrentGame.Character, null),
                "IconMission",
                Mats.Get.IconsAtlas,
                missionColor,
                Color.white);
        }
Ejemplo n.º 37
0
        public void Use(Player p, string[] args)
        {
            if (args.Length == 0 || args.Length > 2)
            {
                Help(p); return;
            }
            Player who;
            string titleColor;

            p.ExtraData.CreateIfNotExist("TitleColor", Server.DefaultColor);

            if (args.Length == 1)
            {
                who        = p;
                titleColor = args[0] == "del" ? "del" : Colors.Parse(args[0]);
                if ((string)p.ExtraData.GetIfExist("TitleColor") == titleColor)
                {
                    p.SendMessage("Your title is already that color!"); return;
                }
            }
            else
            {
                who = Player.Find(args[0]);
                if (who == null)
                {
                    p.SendMessage("Could not find player."); return;
                }
                if (p.Group.Permission <= who.Group.Permission)
                {
                    p.SendMessage("You can't change the title color of someone of equal or higher rank!"); return;
                }
                titleColor = args[1] == "del" ? "del" : Colors.Parse(args[1]);
                if (who.Color == titleColor)
                {
                    p.SendMessage("Their title is already that color!"); return;
                }
            }
            if (titleColor == "")
            {
                p.SendMessage("Could not find color."); return;
            }

            string message = "";

            who.ExtraData.CreateIfNotExist("TitleColor", Server.DefaultColor);

            if (titleColor == "del")
            {
                who.ExtraData["TitleColor"] = "";
                message = "was removed.";
            }
            else
            {
                who.ExtraData["TitleColor"] = titleColor;
                message = "was set to " + titleColor + Colors.Name(titleColor) + who.Color + ".";
            }
            Player.UniversalChat(who.Color + "*" + who.Username + (who.Username.EndsWith("s") || who.Username.EndsWith("x") ? "'" : "'s") + " title color " + message);

            who.SetPrefix();
            //TODO Save to database.
        }
Ejemplo n.º 38
0
 public static bool DrawIconButton(GUIStyle iconStyle, GUIContent content, Size textSize, TextAlign textAlign, ColorName backgroundColorName, ColorName textColorName, float height, bool expandWidth = true)
 {
     return(DrawIconButton(iconStyle, content, textSize, textAlign, Colors.GetDColor(backgroundColorName), Colors.GetDColor(textColorName), height, expandWidth));
 }
Ejemplo n.º 39
0
 public static void Draw(Rect rect, ColorName colorName, CornerType cornerType = DEFAULT_CORNER_TYPE)
 {
     Draw(rect, Colors.GetDColor(colorName), cornerType);
 }
Ejemplo n.º 40
0
 void AddVertexColor(Color4 color)
 {
     Colors.Add(color);
 }
Ejemplo n.º 41
0
 public Piece(PieceType.Types pType, Piece.Colors pColor)
 {
     pieceType = new PieceType(pType);
     color     = pColor;
     hasMoved  = false;
 }
Ejemplo n.º 42
0
 public ThemeConfig()
 {
     // Initialize properties
     Colors      = new Colors();
     SpriteAtlas = new SpriteAtlas();
 }
Ejemplo n.º 43
0
    public void message(string input_text, int duration, string color)
    {
        StopAllCoroutines();
        CR_running = false;
        gameObject.GetComponent <Animator>().Play("Notification_fade_in");

        var textColor = notificationText.GetComponent <TextMeshPro>().color;

        if (CR_running == false)
        {
            gameObject.GetComponent <Visibility_script>().setVisible();

            Colors colors = new Colors();

            switch (color)
            {
            case "gray":
            case "poor":
                notificationText.GetComponent <TextMeshPro>().color = colors.gray;
                break;

            case "white":
            case "common":
                notificationText.GetComponent <TextMeshPro>().color = colors.white;
                break;

            case "green":
            case "uncommon":
                notificationText.GetComponent <TextMeshPro>().color = colors.green;
                break;

            case "blue":
            case "rare":
                notificationText.GetComponent <TextMeshPro>().color = colors.blue;
                break;

            case "purple":
            case "epic":
                notificationText.GetComponent <TextMeshPro>().color = colors.purple;
                break;

            case "yellow":
            case "legendary":
                notificationText.GetComponent <TextMeshPro>().color = colors.yellow;
                break;

            case "red":
                notificationText.GetComponent <TextMeshPro>().color = colors.red;
                break;
            }

            GameObject.Find("Notification text").GetComponent <Text_animation>().startAnim(input_text, 0.05f);
            StartCoroutine("Wait", duration);
        }
        else
        {
            StopCoroutine("Wait");
            gameObject.GetComponent <Visibility_script>().setVisible();
            GameObject.Find("Notification text").GetComponent <Text_animation>().startAnim(input_text, 0.05f);
            gameObject.GetComponent <Animator>().Play("Notification_fade_out");
            StartCoroutine("Wait", duration);
        }
    }
Ejemplo n.º 44
0
 private void SaveColor(object o, EventArgs e)
 {
     Colors.Add(C.Color);
 }
Ejemplo n.º 45
0
 public static bool Draw(string label, Size textSize, ColorName buttonColorName, ColorName textColorName, bool enabled, float height, float width = -1)
 {
     return(Draw(new GUIContent(label), textSize, DEFAULT_TEXT_ALIGN, Colors.GetDColor(buttonColorName), Colors.GetDColor(textColorName), enabled, height, width));
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     this.selectColor.DataSource = Colors.GetColors();
 }
Ejemplo n.º 47
0
 public static bool Draw(Rect rect, GUIContent content, Size textSize, TextAlign textAlign, ColorName buttonColorName, ColorName textColorName, bool enabled)
 {
     return(Draw(rect, content, textSize, textAlign, Colors.GetDColor(buttonColorName), Colors.GetDColor(textColorName), enabled));
 }
Ejemplo n.º 48
0
 public static bool Draw(GUIContent content, Size textSize, TextAlign textAlign, ColorName buttonColorName, ColorName textColorName, bool enabled, float height, float width = -1)
 {
     return(Draw(content, textSize, textAlign, Colors.GetDColor(buttonColorName), Colors.GetDColor(textColorName), enabled, height, width));
 }
Ejemplo n.º 49
0
 public static void Draw(ColorName colorName, float height, params GUILayoutOption[] options)
 {
     Draw(Colors.GetDColor(colorName), DEFAULT_CORNER_TYPE, height, options);
 }
Ejemplo n.º 50
0
 public static bool DrawIconButton(GUIStyle iconStyle, ColorName buttonColorName, ColorName iconColorName, float height)
 {
     return(DrawIconButton(iconStyle, Colors.GetDColor(buttonColorName), Colors.GetDColor(iconColorName), height));
 }
Ejemplo n.º 51
0
        protected override IGUIBrowserObject ConvertEditObjectToBrowserObject(MissionState editObject)
        {
            CreateEmptyDivider = false;

            IGUIBrowserObject       newBrowserObject     = base.ConvertEditObjectToBrowserObject(editObject);
            GUIGenericBrowserObject missionBrowserObject = newBrowserObject.gameObject.GetComponent <GUIGenericBrowserObject>();

            newBrowserObject.AutoSelect = true;

            missionBrowserObject.EditButton.target       = this.gameObject;
            missionBrowserObject.EditButton.functionName = "OnClickBrowserObject";

            string missionText = editObject.Title + " - ";

            missionBrowserObject.Icon.atlas      = Mats.Get.IconsAtlas;
            missionBrowserObject.Icon.spriteName = "IconMission";

            if (editObject.GetPlayerAttention)
            {
                missionBrowserObject.BackgroundHighlight.enabled = true;
                missionBrowserObject.BackgroundHighlight.color   = Colors.Get.GeneralHighlightColor;
            }
            else
            {
                missionBrowserObject.BackgroundHighlight.enabled = false;
            }

            Color missionColor = Colors.Get.MessageInfoColor;
            Color nameColor    = Color.white;

            if (editObject.ObjectivesCompleted)
            {
                CreateCompletedDivider = true;
                if (Flags.Check((uint)editObject.Status, (uint)MissionStatus.Failed, Flags.CheckType.MatchAny))
                {
                    //Debug.Log ("We've failed the mission");
                    missionBrowserObject.name = "e_" + editObject.Name;
                    missionColor = Colors.Get.MessageDangerColor;
                    missionText += "(Failed)";
                }
                else
                {
                    missionBrowserObject.name = "d_" + editObject.Name;
                    missionColor = Colors.Get.MessageSuccessColor;
                    missionText += "(Completed)";
                }
            }
            else
            {
                //Debug.Log ("We're not completed");
                if (Flags.Check((uint)editObject.Status, (uint)MissionStatus.Failed, Flags.CheckType.MatchAny))
                {
                    missionColor = Colors.Get.MessageDangerColor;
                    missionText += "(Failed)";
                    missionBrowserObject.name = "g_" + editObject.Name;
                }
                else if (Flags.Check((uint)editObject.Status, (uint)MissionStatus.Ignored, Flags.CheckType.MatchAny))
                {
                    CreateCompletedDivider    = true;
                    missionColor              = Colors.Get.MessageWarningColor;
                    missionText              += "(Ignored)";
                    missionBrowserObject.name = "f_" + editObject.Name;
                }
                else
                {
                    CreateActiveDivider       = true;
                    missionBrowserObject.name = "b_" + editObject.Name;
                    //the quest is active but not completed
                    int numObjectivesOutstanding = 0;
                    for (int i = 0; i < editObject.Objectives.Count; i++)
                    {
                        if (editObject.Objectives[i].Hidden || editObject.Objectives[i].Completed)
                        {
                            //doesn't count towards outstanding tasks
                            continue;
                        }
                        if (Flags.Check((uint)editObject.Objectives[i].Status, (uint)MissionStatus.Active, Flags.CheckType.MatchAny))
                        {
                            numObjectivesOutstanding++;
                        }
                    }
                    if (numObjectivesOutstanding > 1)
                    {
                        missionText += Colors.ColorWrap("(" + numObjectivesOutstanding.ToString() + " objectives outstanding)", Colors.Dim(nameColor));
                    }
                    else
                    {
                        missionText += Colors.ColorWrap("(" + numObjectivesOutstanding.ToString() + " objective outstanding)", Colors.Dim(nameColor));
                    }
                }
            }

            missionBrowserObject.Name.text                  = missionText;
            missionBrowserObject.Name.color                 = nameColor;
            missionBrowserObject.Background.color           = Colors.Darken(missionColor);
            missionBrowserObject.Icon.color                 = missionColor;
            missionBrowserObject.MiniIcon.enabled           = false;
            missionBrowserObject.MiniIconBackground.enabled = false;

            missionBrowserObject.Initialize(editObject.Name);
            missionBrowserObject.Refresh();

            return(newBrowserObject);
        }
Ejemplo n.º 52
0
 public static void Draw(ColorName colorName, CornerType cornerType, float height, params GUILayoutOption[] options)
 {
     Draw(Colors.GetDColor(colorName), cornerType, height, options);
 }
Ejemplo n.º 53
0
 public ColorAttribute(Colors color)
 {
     Color = color;
 }
Ejemplo n.º 54
0
        protected override void RenderEffect(int frame, IPixelFrameBuffer frameBuffer)
        {
            var buffer = frameBuffer as PixelLocationFrameBuffer;

            if (buffer != null)
            {
                RenderEffectByLocation(frame, buffer);
            }

            int    x, y, n, colorIdx;
            int    colorcnt          = Colors.Count();
            int    barCount          = Repeat * colorcnt;
            double intervalPosFactor = GetEffectTimeIntervalPosition(frame) * 100;

            _negPosition = false;

            if (MovementType == MovementType.Iterations)
            {
                _position = (GetEffectTimeIntervalPosition(frame) * Speed) % 1;
            }
            else
            {
                if (frame == 0)
                {
                    _position = CalculateSpeed(intervalPosFactor);
                }
                _position += CalculateSpeed(intervalPosFactor) / 100;
                if (_position < 0)
                {
                    _negPosition = true;
                    _position    = -_position;
                }
            }

            if (barCount < 1)
            {
                barCount = 1;
            }
            double level = LevelCurve.GetValue(intervalPosFactor) / 100;

            if (Direction < BarDirection.Left || Direction == BarDirection.AlternateUp || Direction == BarDirection.AlternateDown)
            {
                int barHt = BufferHt / barCount + 1;
                if (barHt < 1)
                {
                    barHt = 1;
                }
                int halfHt  = BufferHt / 2;
                int blockHt = colorcnt * barHt;
                if (blockHt < 1)
                {
                    blockHt = 1;
                }
                int fOffset = (int)(_position * blockHt * Repeat);             // : Speed * frame / 4 % blockHt);
                if (Direction == BarDirection.AlternateUp || Direction == BarDirection.AlternateDown)
                {
                    fOffset = (int)(Math.Floor(_position * barCount) * barHt);
                }
                int indexAdjust = 1;

                for (y = 0; y < BufferHt; y++)
                {
                    n        = y + fOffset;
                    colorIdx = ((n + indexAdjust) % blockHt) / barHt;
                    //we need the integer division here to make things work
                    float colorPosition = ((n + indexAdjust) / barHt) - ((n + indexAdjust) / barHt);
                    Color c             = Colors[colorIdx].GetColorAt(colorPosition);
                    if (Highlight || Show3D)
                    {
                        var hsv = HSV.FromRGB(c);
                        if (Highlight && (n + indexAdjust) % barHt == 0)
                        {
                            hsv.S = 0.0f;
                        }
                        if (Show3D)
                        {
                            hsv.V *= (float)(barHt - (n + indexAdjust) % barHt - 1) / barHt;
                        }
                        hsv.V *= level;
                        c      = hsv.ToRGB();
                    }
                    else
                    {
                        if (level < 1)
                        {
                            HSV hsv = HSV.FromRGB(c);
                            hsv.V *= level;
                            c      = hsv.ToRGB();
                        }
                    }

                    switch (Direction)
                    {
                    case BarDirection.Down:
                    case BarDirection.AlternateDown:
                        // dow
                        if (_negPosition)
                        {
                            for (x = 0; x < BufferWi; x++)
                            {
                                frameBuffer.SetPixel(x, BufferHt - y - 1, c);
                            }
                        }
                        else
                        {
                            for (x = 0; x < BufferWi; x++)
                            {
                                frameBuffer.SetPixel(x, y, c);
                            }
                        }

                        break;

                    case BarDirection.Expand:
                        // expand
                        if (_negPosition)
                        {
                            if (y <= halfHt)
                            {
                                for (x = 0; x < BufferWi; x++)
                                {
                                    frameBuffer.SetPixel(x, y, c);
                                    frameBuffer.SetPixel(x, BufferHt - y - 1, c);
                                }
                            }
                        }
                        else
                        {
                            if (y >= halfHt)
                            {
                                for (x = 0; x < BufferWi; x++)
                                {
                                    frameBuffer.SetPixel(x, y, c);
                                    frameBuffer.SetPixel(x, BufferHt - y - 1, c);
                                }
                            }
                        }
                        break;

                    case BarDirection.Compress:
                        // compress
                        if (!_negPosition)
                        {
                            if (y <= halfHt)
                            {
                                for (x = 0; x < BufferWi; x++)
                                {
                                    frameBuffer.SetPixel(x, y, c);
                                    frameBuffer.SetPixel(x, BufferHt - y - 1, c);
                                }
                            }
                        }
                        else
                        {
                            if (y >= halfHt)
                            {
                                for (x = 0; x < BufferWi; x++)
                                {
                                    frameBuffer.SetPixel(x, y, c);
                                    frameBuffer.SetPixel(x, BufferHt - y - 1, c);
                                }
                            }
                        }
                        break;

                    default:
                        // up & AlternateUp
                        if (!_negPosition)
                        {
                            for (x = 0; x < BufferWi; x++)
                            {
                                frameBuffer.SetPixel(x, BufferHt - y - 1, c);
                            }
                        }
                        else
                        {
                            for (x = 0; x < BufferWi; x++)
                            {
                                frameBuffer.SetPixel(x, y, c);
                            }
                        }
                        break;
                    }
                }
            }
            else
            {
                int barWi = BufferWi / barCount + 1;
                if (barWi < 1)
                {
                    barWi = 1;
                }
                int halfWi  = BufferWi / 2;
                int blockWi = colorcnt * barWi;
                if (blockWi < 1)
                {
                    blockWi = 1;
                }
                int fOffset = (int)(_position * blockWi * Repeat);
                if (Direction > BarDirection.AlternateDown)
                {
                    fOffset = (int)(Math.Floor(_position * barCount) * barWi);
                }

                for (x = 0; x < BufferWi; x++)
                {
                    n        = x + fOffset;
                    colorIdx = ((n + 1) % blockWi) / barWi;
                    //we need the integer division here to make things work
                    float colorPosition = ((n + 1) / barWi) - ((n + 1) / barWi);
                    Color c             = Colors[colorIdx].GetColorAt(colorPosition);
                    if (Highlight || Show3D)
                    {
                        var hsv = HSV.FromRGB(c);
                        if (Highlight && n % barWi == 0)
                        {
                            hsv.S = 0.0f;
                        }
                        if (Show3D)
                        {
                            hsv.V *= (float)(barWi - n % barWi - 1) / barWi;
                        }
                        hsv.V *= level;
                        c      = hsv.ToRGB();
                    }
                    else
                    {
                        if (level < 1)
                        {
                            HSV hsv = HSV.FromRGB(c);
                            hsv.V *= level;
                            c      = hsv.ToRGB();
                        }
                    }

                    switch (Direction)
                    {
                    case BarDirection.Right:
                    case BarDirection.AlternateRight:
                        // right
                        for (y = 0; y < BufferHt; y++)
                        {
                            frameBuffer.SetPixel(BufferWi - x - 1, y, c);
                        }
                        break;

                    case BarDirection.HExpand:
                        // H-expand
                        if (x <= halfWi)
                        {
                            for (y = 0; y < BufferHt; y++)
                            {
                                frameBuffer.SetPixel(x, y, c);
                                frameBuffer.SetPixel(BufferWi - x - 1, y, c);
                            }
                        }
                        break;

                    case BarDirection.HCompress:
                        // H-compress
                        if (x >= halfWi)
                        {
                            for (y = 0; y < BufferHt; y++)
                            {
                                frameBuffer.SetPixel(x, y, c);
                                frameBuffer.SetPixel(BufferWi - x - 1, y, c);
                            }
                        }
                        break;

                    default:
                        // left & AlternateLeft
                        for (y = 0; y < BufferHt; y++)
                        {
                            frameBuffer.SetPixel(x, y, c);
                        }
                        break;
                    }
                }
            }
        }
Ejemplo n.º 55
0
        protected override void RenderEffectByLocation(int numFrames, PixelLocationFrameBuffer frameBuffer)
        {
            int colorcnt = Colors.Count();
            int barCount = Repeat * colorcnt;

            if (barCount < 1)
            {
                barCount = 1;
            }

            int barHt = BufferHt / barCount + 1;

            if (barHt < 1)
            {
                barHt = 1;
            }
            int blockHt = colorcnt * barHt;

            if (blockHt < 1)
            {
                blockHt = 1;
            }

            int barWi = BufferWi / barCount + 1;

            if (barWi < 1)
            {
                barWi = 1;
            }
            int blockWi = colorcnt * barWi;

            if (blockWi < 1)
            {
                blockWi = 1;
            }

            IEnumerable <IGrouping <int, ElementLocation> > nodes;
            List <IGrouping <int, ElementLocation> >        reversedNodes = new List <IGrouping <int, ElementLocation> >();

            switch (Direction)
            {
            case BarDirection.AlternateUp:
            case BarDirection.Up:
                nodes = frameBuffer.ElementLocations.OrderBy(x => x.Y).ThenBy(x => x.X).GroupBy(x => x.Y);
                break;

            case BarDirection.Left:
            case BarDirection.AlternateLeft:
                nodes = frameBuffer.ElementLocations.OrderByDescending(x => x.X).ThenBy(x => x.Y).GroupBy(x => x.X);
                break;

            case BarDirection.Right:
            case BarDirection.AlternateRight:
                nodes = frameBuffer.ElementLocations.OrderBy(x => x.X).ThenBy(x => x.Y).GroupBy(x => x.X);
                break;

            case BarDirection.Compress:
            case BarDirection.Expand:
                nodes         = frameBuffer.ElementLocations.OrderByDescending(x => x.Y).ThenBy(x => x.X).GroupBy(x => x.Y);
                reversedNodes = nodes.Reverse().ToList();
                break;

            case BarDirection.HCompress:
            case BarDirection.HExpand:
                nodes         = frameBuffer.ElementLocations.OrderBy(x => x.X).ThenBy(x => x.Y).GroupBy(x => x.X);
                reversedNodes = nodes.Reverse().ToList();
                break;

            default:
                nodes = frameBuffer.ElementLocations.OrderByDescending(x => x.Y).ThenBy(x => x.X).GroupBy(x => x.Y);
                break;
            }
            var nodeCount     = nodes.Count();
            var halfNodeCount = (nodeCount - 1) / 2;
            var evenHalfCount = nodeCount % 2 != 0;

            for (int frame = 0; frame < numFrames; frame++)
            {
                frameBuffer.CurrentFrame = frame;
                double intervalPosFactor = GetEffectTimeIntervalPosition(frame) * 100;
                double level             = LevelCurve.GetValue(intervalPosFactor) / 100;

                if (MovementType == MovementType.Iterations)
                {
                    _position = (GetEffectTimeIntervalPosition(frame) * Speed) % 1;
                }
                else
                {
                    if (frame == 0)
                    {
                        _position = CalculateSpeed(intervalPosFactor);
                    }
                    _position += CalculateSpeed(intervalPosFactor) / 100;
                }

                int n;
                int colorIdx;
                if (Direction < BarDirection.Left || Direction == BarDirection.AlternateUp || Direction == BarDirection.AlternateDown)
                {
                    int fOffset = (int)(_position * blockHt * Repeat);                    // : Speed * frame / 4 % blockHt);
                    if (Direction == BarDirection.AlternateUp || Direction == BarDirection.AlternateDown)
                    {
                        fOffset = (int)(Math.Floor(_position * barCount) * barHt);
                    }
                    if (Direction == BarDirection.Down || Direction == BarDirection.AlternateDown || Direction == BarDirection.Expand)
                    {
                        fOffset = -fOffset;
                    }

                    int indexAdjust = 1;

                    int  i        = 0;
                    bool exitLoop = false;
                    foreach (IGrouping <int, ElementLocation> elementLocations in nodes)
                    {
                        int y = elementLocations.Key;
                        n        = y + fOffset;
                        colorIdx = Math.Abs(((n + indexAdjust) % blockHt) / barHt);

                        //we need the integer division here to make things work
                        double colorPosition = Math.Abs((double)(n + indexAdjust) / barHt - (n + indexAdjust) / barHt);
                        Color  c             = Colors[colorIdx].GetColorAt(colorPosition);
                        if (Highlight || Show3D)
                        {
                            var hsv = HSV.FromRGB(c);
                            if (Highlight && (n + indexAdjust) % barHt == 0)
                            {
                                hsv.S = 0.0f;
                            }
                            if (Show3D)
                            {
                                hsv.V *= (float)(barHt - (n + indexAdjust) % barHt - 1) / barHt;
                            }
                            hsv.V *= level;
                            c      = hsv.ToRGB();
                        }
                        else
                        {
                            if (level < 1)
                            {
                                HSV hsv = HSV.FromRGB(c);
                                hsv.V *= level;
                                c      = hsv.ToRGB();
                            }
                        }

                        switch (Direction)
                        {
                        case BarDirection.Expand:
                        case BarDirection.Compress:
                            // expand / compress
                            if (i <= halfNodeCount)
                            {
                                foreach (var elementLocation in elementLocations)
                                {
                                    frameBuffer.SetPixel(elementLocation.X, y, c);
                                }
                                if (i == halfNodeCount & evenHalfCount)
                                {
                                    i++;
                                    continue;
                                }
                                foreach (var elementLocation in reversedNodes[i])
                                {
                                    frameBuffer.SetPixel(elementLocation.X, elementLocation.Y, c);
                                }

                                i++;
                            }
                            else
                            {
                                exitLoop = true;
                            }
                            break;

                        default:
                            foreach (var elementLocation in elementLocations)
                            {
                                frameBuffer.SetPixel(elementLocation.X, y, c);
                            }
                            break;
                        }
                        if (exitLoop)
                        {
                            break;
                        }
                    }
                }
                else
                {
                    int fOffset = (int)(_position * blockWi * Repeat);
                    if (Direction > BarDirection.AlternateDown)
                    {
                        fOffset = (int)(Math.Floor(_position * barCount) * barWi);
                    }
                    if (Direction == BarDirection.Right || Direction == BarDirection.AlternateRight || Direction == BarDirection.HCompress)
                    {
                        fOffset = -fOffset;
                    }

                    int i = 0;

                    foreach (IGrouping <int, ElementLocation> elementLocations in nodes)
                    {
                        int x = elementLocations.Key;
                        n        = x + fOffset;
                        colorIdx = Math.Abs(((n + 1) % blockWi) / barWi);
                        //we need the integer division here to make things work
                        double colorPosition = Math.Abs((double)(n + 1) / barWi - (n + 1) / barWi);
                        Color  c             = Colors[colorIdx].GetColorAt(colorPosition);

                        if (Highlight || Show3D)
                        {
                            var hsv = HSV.FromRGB(c);
                            if (Highlight && n % barWi == 0)
                            {
                                hsv.S = 0.0f;
                            }
                            if (Show3D)
                            {
                                hsv.V *= (float)(barWi - n % barWi - 1) / barWi;
                            }
                            hsv.V *= level;
                            c      = hsv.ToRGB();
                        }
                        else
                        {
                            if (level < 1)
                            {
                                HSV hsv = HSV.FromRGB(c);
                                hsv.V *= level;
                                c      = hsv.ToRGB();
                            }
                        }

                        switch (Direction)
                        {
                        case BarDirection.HExpand:
                        case BarDirection.HCompress:
                            if (i <= halfNodeCount)
                            {
                                foreach (var elementLocation in elementLocations)
                                {
                                    frameBuffer.SetPixel(x, elementLocation.Y, c);
                                }
                                if (i == halfNodeCount & evenHalfCount)
                                {
                                    i++;
                                    continue;
                                }
                                foreach (var elementLocation in reversedNodes[i])
                                {
                                    frameBuffer.SetPixel(elementLocation.X, elementLocation.Y, c);
                                }

                                i++;
                            }
                            break;

                        default:
                            foreach (var elementLocation in elementLocations)
                            {
                                frameBuffer.SetPixel(x, elementLocation.Y, c);
                            }
                            break;
                        }
                    }
                }
            }
        }
Ejemplo n.º 56
0
 protected override void OnRenderArrow(ToolStripArrowRenderEventArgs e)
 {
     e.ArrowColor = Colors.Font();
     base.OnRenderArrow(e);
 }
Ejemplo n.º 57
0
        private void StubForm_Load(object sender, EventArgs e)
        {
            Colors.SetRTCColor(Color.FromArgb(149, 120, 161), this);

            Focus();
        }
Ejemplo n.º 58
0
 public static bool Draw(Rect rect, string label, Size textSize, TextAlign textAlign, ColorName buttonColorName, ColorName textColorName, bool enabled)
 {
     return(Draw(rect, new GUIContent(label), textSize, textAlign, Colors.GetDColor(buttonColorName), Colors.GetDColor(textColorName), enabled));
 }
Ejemplo n.º 59
0
 public static bool Draw(Rect rect, GUIStyle style, ColorName iconColorName)
 {
     return(Draw(rect, style, Colors.IconColor(iconColorName)));
 }
Ejemplo n.º 60
0
 public static bool Draw(GUIStyle style, ColorName iconColorName, float rowHeight = -1)
 {
     return(Draw(style, Colors.IconColor(iconColorName), rowHeight));
 }