public override void Decode(Lidgren.Network.NetIncomingMessage msg)
 {
     timesDisplayed =      msg.ReadByte();
     ballColor = (MyColor) msg.ReadByte();
     textColor = (MyColor) msg.ReadByte();
     textWord =  (MyColor) msg.ReadByte();
 }
예제 #2
0
	static int Main ()
	{
		MyColor [] c = new MyColor [1];
		c [0] += new MyColor (1.3F);
		c [0] += new MyColor (1.5F);
		if (c [0].Value != 2.8F)
			return 1;
		return 0;
	}
예제 #3
0
            public MyColor GetColor(int x, int y)
            {
                int  pos = y * stride + x * 4;
                byte a   = data[pos + 3];
                byte r   = data[pos + 2];
                byte g   = data[pos + 1];
                byte b   = data[pos + 0];

                return(MyColor.FromARGB(a, r, g, b));
            }
예제 #4
0
        public virtual void ChangeColor(MyColor newColor)
        {
            (PressColor = newColor.Duplicate()).AdjustLight(-0.6f);
            DefaultColor = newColor.Duplicate();
            ColorChanger.SetColor(newColor);

            ScreenTexture.ColorChanger.ResetColor(newColor);

            OnColorChanged?.Invoke(newColor);
        }
예제 #5
0
        private Color YourMethodConvertMyColorToColor(MyColor c)
        {
            //your implementation
            if (c == MyColor.MyColorGreen)
            {
                return(ColorTranslator.FromHtml("#FF0000"));;     //just example
            }

            return(Color.Green);   //default
        }
예제 #6
0
    public void ResetPalette()
    {
        this.DefaultColor = MyColor.None;
        foreach (var go in this.colors)
        {
            GameObject.Destroy(go);
        }

        this.colors.Clear();
    }
예제 #7
0
        public MyColor SkyColorAtPointDist(double h0, GeoPolar2d p, double dist, MyColor ground, double nDotL, double ambiantLight)
        {
            double theta = GetTheta(p);

            SkyColorAtPointComputer(h0, dist, out MyDColor attenuation, out MyDColor airColorR, out MyDColor airColorM, out MyDColor directPart);

            MyColor color = CombineForAerialPrespective(ground, theta, nDotL, ambiantLight, ref attenuation, ref airColorR, ref airColorM, ref directPart);

            return(color);
        }
예제 #8
0
            public static MyColor FromARGB(byte a, byte r, byte g, byte b)
            {
                MyColor mc = new MyColor();

                mc.A = a;
                mc.R = r;
                mc.G = g;
                mc.B = b;
                return(mc);
            }
예제 #9
0
        private static MyColor ScaleColor(ref MyDColor tot)
        {
            double scale = -45.0;
            var    color = new MyColor(
                (byte)(255 * Math.Max(0.0, Math.Min(1.0, 1 - Math.Exp(scale * tot.R)))),
                (byte)(255 * Math.Max(0.0, Math.Min(1.0, 1 - Math.Exp(scale * tot.G)))),
                (byte)(255 * Math.Max(0.0, Math.Min(1.0, 1 - Math.Exp(scale * tot.B)))));

            return(color);
        }
예제 #10
0
        private static MyColor GetColor(double vx, double vy)
        {
            // Use those views to determine the color
            var cr = (byte)(127 * (Math.Pow(Math.Sin(vx * 100), 2) + Math.Pow(Math.Cos(vy * 100), 2)));
            var cg = (byte)(127 * (Math.Pow(Math.Sin(vx * 30), 2) + Math.Pow(Math.Cos(vy * 20), 2)));
            var cb = (byte)(127 * (Math.Pow(Math.Sin(vx * 20), 2) + Math.Pow(Math.Cos(vy * 30), 2)));
            var c  = new MyColor(cr, cg, cb);

            return(c);
        }
예제 #11
0
 public Lichtquelle_Partikel(Model partikelmodel, Vector3 position, Vector3 richtung, Lichtquelle_Partikel vorgänger, Lichtquelle_Partikel nachfolger, MyColor farbe, Effect effect)
 {
     this.effect        = effect;
     this.farbe         = farbe;
     this.partikelmodel = partikelmodel;
     this.position      = position;
     this.richtung      = richtung;
     this.vorgänger     = vorgänger;
     this.nachfolger    = nachfolger;
 }
예제 #12
0
        private static MyColor GetColor(int x, int y, int stride, byte[] data)
        {
            int  pos = y * stride + x * 4;
            byte a   = data[pos + 3];
            byte r   = data[pos + 2];
            byte g   = data[pos + 1];
            byte b   = data[pos + 0];

            return(MyColor.FromARGB(a, r, g, b));
        }
예제 #13
0
        private void button1_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("aaaaa", "提示", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Stop);

            MessageBox.Show(result.ToString());

            MyColor color = MyColor.Blue;

            MessageBox.Show(color.ToString());
        }
예제 #14
0
        public void CreateY1(int x, int y, int z, MyColor[] color)
        {
            var newColor = new MyColor[color.Length];

            for (int i = 0; i < color.Length; i++)
            {
                newColor[i] = GlobalLight(color[i], orientVertices[QuadOrient.y1]);
            }

            quadranglesY1.Add(new Quadrangle(x, y, z, newColor));
        }
예제 #15
0
파일: Program.cs 프로젝트: pinerge/Testing
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            MyColor c = MyColor.Blue;

            if (c == MyColor.Blue)
            {
                Console.WriteLine(c);
            }
            c = (MyColor)Enum.Parse(typeof(MyColor), "Red");
        }
예제 #16
0
        static MyColor GetAllColors()
        {
            MyColor allColors = (MyColor)0;

            foreach (MyColor color in Enum.GetValues(typeof(MyColor)))
            {
                allColors |= color;
            }

            return(allColors);
        }
예제 #17
0
파일: test-586.cs 프로젝트: yonder/mono
 static int Main()
 {
     MyColor [] c = new MyColor [1];
     c [0] += new MyColor(1.3F);
     c [0] += new MyColor(1.5F);
     if (c [0].Value != 2.8F)
     {
         return(1);
     }
     return(0);
 }
예제 #18
0
        public void Read16(MyColor[] outputBuffer)
        {
            //bgra to argb
            //16 px
            byte b, g, r, a;
            int  m         = 0;
            int  tmpY      = this.cY - 1;
            int  byteIndex = ((tmpY * stride) + cX * 4);

            byteIndex -= 4;//step back
            //-------------------------------------------------
            for (int n = 0; n < 4; ++n)
            {
                //0
                b = buffer[byteIndex];
                g = buffer[byteIndex + 1];
                r = buffer[byteIndex + 2];
                a = buffer[byteIndex + 3];

                outputBuffer[m] = new MyColor(r, g, b, a);
                byteIndex      += 4;
                //------------------------------------------------
                //1
                b = buffer[byteIndex];
                g = buffer[byteIndex + 1];
                r = buffer[byteIndex + 2];
                a = buffer[byteIndex + 3];
                outputBuffer[m + 1] = new MyColor(r, g, b, a);
                byteIndex          += 4;
                //------------------------------------------------
                //2
                b = buffer[byteIndex];
                g = buffer[byteIndex + 1];
                r = buffer[byteIndex + 2];
                a = buffer[byteIndex + 3];
                outputBuffer[m + 2] = new MyColor(r, g, b, a);
                byteIndex          += 4;
                //------------------------------------------------
                //3
                b = buffer[byteIndex];
                g = buffer[byteIndex + 1];
                r = buffer[byteIndex + 2];
                a = buffer[byteIndex + 3];
                outputBuffer[m + 3] = new MyColor(r, g, b, a);
                byteIndex          += 4;
                //------------------------------------------------
                m += 4;

                //go next row
                tmpY++;
                byteIndex  = (tmpY * stride) + (cX * 4);
                byteIndex -= 4;
            }
        }
예제 #19
0
 private void HanldeColorChanged(bool flag, MyColor myColor)
 {
     if (flag)
     {
         PuzzleComponent.Instance.AddColor(myColor);
     }
     else
     {
         PuzzleComponent.Instance.RemoveColor(myColor);
     }
 }
예제 #20
0
 public override object ConvertTo(ITypeDescriptorContext context,
                                  System.Globalization.CultureInfo culture, object value,
                                  Type destinationType)
 {
     if (destinationType == typeof(string))
     {
         MyColor color = (MyColor)value;
         return(color.Id + "--" + color.Name);
     }
     return(base.ConvertTo(context, culture, value, destinationType));
 }
예제 #21
0
 static void SeparateByChannel(MyColor[] myColors, byte[] rBuffer, byte[] gBuffer, byte[] bBuffer, byte[] aBuffer)
 {
     for (int i = 0; i < 16; ++i)
     {
         MyColor m = myColors[i];
         rBuffer[i] = m.r;
         gBuffer[i] = m.g;
         bBuffer[i] = m.b;
         aBuffer[i] = m.a;
     }
 }
예제 #22
0
        public static string ShowBackgroundColor(object obj)
        {
            MyColor ret = null;

            try
            {
                Type t = obj.GetType();
                if (t.Equals(typeof(MyPhysicalView)))
                {
                    return("no-color");
                }
                #if __XAMARIN__ || __MAC__
                else if (t.Equals(typeof(MyScrollView)))
                {
                    return("no-color");
                }
                #endif //__XAMARIN__ || __MAC__

                if (is_MyBase_Type(obj))
                {
                    ret = ((MyBase)obj)._myBackgroundColor;
                }
                else if (t.Equals(typeof(MyPage)))
                {
                    ret = ((MyPage)obj)._myBackgroundColor;
                }
                else if (t.Equals(typeof(MyDialog_Template)))
                {
                    ret = ((MyDialog_Template)obj)._myBackgroundColor;
                }
                else if (t.Equals(typeof(MyDialog_Image)))
                {
                    ret = ((MyDialog_Image)obj)._myBackgroundColor;
                }
                else if (t.Equals(typeof(MyView_Stk)))
                {
                    ret = ((MyView_Stk)obj)._myBackgroundColor;
                }
                else
                {
                    MyDebug.DoAssert(false, "fixme: Handle all types here: " + t.ToString());
                }
                if (ret != null)
                {
                    return(ret.ToString());
                }
            }
            catch (Exception e)
            {
                Global.DumpException(e);
                MyDebug.DoAssert(false, "fixme: Handle all types here: " + obj.GetType().ToString());
            }
            return("-null-");
        }
예제 #23
0
            public static MyColor FromARGB(byte a, byte r, byte g, byte b)
            {
                MyColor mc = new MyColor
                {
                    A = a,
                    R = r,
                    G = g,
                    B = b
                };

                return(mc);
            }
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value == null)
            {
                return(DependencyProperty.UnsetValue);
            }

            MyColor color = (MyColor)Enum.Parse(typeof(MyColor), value as string, true);

            return(color);
            //return GetDescription((Enum)value);
        }
예제 #25
0
    public void SetColor(MyColor color)
    {
        this.color = color;
        switch (color)
        {
        case MyColor.red: weaponHead.GetComponent <SpriteRenderer>().sprite = weaponHeadSprites[0]; break;

        case MyColor.blue: weaponHead.GetComponent <SpriteRenderer>().sprite = weaponHeadSprites[1]; break;

        case MyColor.green: weaponHead.GetComponent <SpriteRenderer>().sprite = weaponHeadSprites[2]; break;
        }
    }
예제 #26
0
        private static MyDColor InverseScaleColor(ref MyColor color)
        {
            double   scale = -45.0;
            MyDColor tot   = new MyDColor()
            {
                R = Math.Log(1.0 - color.R / 255.0) / scale,
                G = Math.Log(1.0 - color.G / 255.0) / scale,
                B = Math.Log(1.0 - color.B / 255.0) / scale,
            };

            return(tot);
        }
예제 #27
0
 public Shape(int _name, MyPaintSettings settings)
 {
     myPrimaryColor = new MyColor(settings.PrimaryColor);
     mySecondColor  = new MyColor(settings.SecondaryColor);
     myOutlineColor = new MyColor(settings.OutlineColor);
     stt            = _name;
     primaryColor   = myPrimaryColor.ToColor();
     secondColor    = mySecondColor.ToColor();
     outlineColor   = myOutlineColor.ToColor();
     width          = settings.Width;
     lineStyle      = settings.LineStyle;
     angleIn        = 0;
 }
예제 #28
0
        public void SetCellValue(string headName, string value, MyColor color = MyColor.Black, StyleXls style = StyleXls.默认)
        {
            this.validate(headName);
            this.SetHeadStyles(headName, color, style);
            ICell cell = this.row.CreateCell(this.defineLocation[headName]);

            if (string.IsNullOrWhiteSpace(value))
            {
                value = "";
            }
            cell.SetCellValue(value);
            cell.CellStyle = headStyles[headName + color.ToString()];
        }
 public void LoadColors()
 {
     _tempInner = _sh.LoadData("InnerColor") as MyColor;
     _tempOuter = _sh.LoadData("OuterColor") as MyColor;
     if (_tempInner == null)
     {
         _tempInner = (Color) new Color32(199, 0, 1, 255);                     // Courtesy of Julius
     }
     if (_tempOuter == null)
     {
         _tempOuter = new Color(0, 0, 0);
     }
 }
예제 #30
0
    public void LaunchGame()
    {
        Runtime.player1Color = MyColor.StringToColor(player1Color.itemList[player1Color.index].itemTitle);
        Runtime.player2Color = MyColor.StringToColor(player2Color.itemList[player2Color.index].itemTitle);
        Runtime.player1Name  = player1Name.text;
        Runtime.player2Name  = player2Name.text;

        //SceneManager.LoadScene(2);

        panel.SetActive(false);

        StartCoroutine(LoadScene(2));
    }
예제 #31
0
            public override bool Equals(object obj)
            {
                if (!(obj is MyColor))
                {
                    return(false);
                }
                MyColor color = (MyColor)obj;

                if (color.A == this.A && color.R == this.R && color.G == this.G && color.B == this.B)
                {
                    return(true);
                }
                return(false);
            }
예제 #32
0
    public int CompareTo(object obj)
    {
        MyColor ob = (MyColor)obj;

        if (I > ob.I)
        {
            return(1);
        }
        if (I == ob.I)
        {
            return(0);
        }
        return(-1);
    }
예제 #33
0
 public void Read16(MyColor[] outputBuffer)
 {
     //bgra to argb
     //16 px 
     byte b, g, r, a;
     int m = 0;
     int tmpY = this.cY - 1;
     int byteIndex = ((tmpY * stride) + cX * 4);
     byteIndex -= 4;//step back
     //-------------------------------------------------             
     for (int n = 0; n < 4; ++n)
     {
         //0
         b = buffer[byteIndex];
         g = buffer[byteIndex + 1];
         r = buffer[byteIndex + 2];
         a = buffer[byteIndex + 3];
         outputBuffer[m] = new MyColor(r, g, b, a);
         byteIndex += 4;
         //------------------------------------------------
         //1
         b = buffer[byteIndex];
         g = buffer[byteIndex + 1];
         r = buffer[byteIndex + 2];
         a = buffer[byteIndex + 3];
         outputBuffer[m + 1] = new MyColor(r, g, b, a);
         byteIndex += 4;
         //------------------------------------------------
         //2
         b = buffer[byteIndex];
         g = buffer[byteIndex + 1];
         r = buffer[byteIndex + 2];
         a = buffer[byteIndex + 3];
         outputBuffer[m + 2] = new MyColor(r, g, b, a);
         byteIndex += 4;
         //------------------------------------------------
         //3
         b = buffer[byteIndex];
         g = buffer[byteIndex + 1];
         r = buffer[byteIndex + 2];
         a = buffer[byteIndex + 3];
         outputBuffer[m + 3] = new MyColor(r, g, b, a);
         byteIndex += 4;
         //------------------------------------------------
         m += 4;
         //go next row
         tmpY++;
         byteIndex = (tmpY * stride) + (cX * 4);
         byteIndex -= 4;
     }
 }
예제 #34
0
 public void EventEnum1(MyColor x) { WriteEvent(19, x); }
예제 #35
0
 public void EventEnum(MyColor x) { WriteEvent(18, (int)x); }
 internal void LogColor(MyColor color) { if (this.IsEnabled()) this.WriteEvent(8, (int)color); }
 public void LogColor(MyColor color) { WriteEvent(8, (int)color); }
예제 #38
0
 public void SendEnums(MyColor color, MyFlags flags) {
     if(IsEnabled())  
         WriteEvent(1, (int) color, (int) flags); 
 } // Cast enums to int for efficient logging.
 public void SendEnumsEvent17(MyColor a, MyFlags b)
 {
     this.WriteEvent(5, (int)a, (int)b);
 }
 public void SendEnumsEvent16(MyColor a, MyFlags b)
 {
     this.WriteEvent(3, a, b);
 }
        public override void Update(GameTime gameTime)
        {
            if (player != Game1.localPlayer)
                return; // this puzzle only updates by its owner
            if (timesDisplayed > 60)
            {
                ballColor = (MyColor)((Game1.random.Next(1, 4) + (int)ballColor) % 4);
                textColor = (MyColor)((Game1.random.Next(1, 4) + (int)textColor) % 4);
                if (textColor == ballColor)
                    textColor = (MyColor)(((int) textColor + 1) % 4);
                textWord = (MyColor)((Game1.random.Next(1, 4) + (int)textWord) % 4);
                if (textWord == textColor && Game1.random.Next(2) == 1)
                    textWord = ballColor;
                timesDisplayed = 0;
                if (ballColor == textWord)
                    numberMissed++;
                if (numberMissed > 2)
                    PuzzleOver(false);
                return;
            }

            mouse = Mouse.GetState();

            if (mouse.LeftButton == ButtonState.Pressed && prevMouse.LeftButton == ButtonState.Released)
                leftClick.Play(gameTime, mouse.Position());

            if (mouse.LeftButton.IsClicked() && ballPosition.Contains(mouse.PPosition()))
            {
                if (ballColor == textWord)
                    PuzzleOver(true); // Correct
                else
                    PuzzleOver(false);
            }
            prevMouse = mouse;
        }
 public void SendEnumsEvent15(MyColor color, MyFlags flags) 
 {
     this.WriteEvent(15, (int)color, (int)flags);
 }
예제 #43
0
 /// <summary>
 /// Checks if the color matches the color of this ObjectColor
 /// </summary>
 public bool CheckSameColor(MyColor color) {
     return myColor == color;
 }
예제 #44
0
 public void Read4(MyColor[] outputBuffer)
 {
     byte b, g, r, a;
     int m = 0;
     int tmpY = this.cY;
     int byteIndex = ((tmpY * stride) + cX * 4);
     b = buffer[byteIndex];
     g = buffer[byteIndex + 1];
     r = buffer[byteIndex + 2];
     a = buffer[byteIndex + 3];
     outputBuffer[m] = new MyColor(r, g, b, a);
     byteIndex += 4;
     //-----------------------------------
     b = buffer[byteIndex];
     g = buffer[byteIndex + 1];
     r = buffer[byteIndex + 2];
     a = buffer[byteIndex + 3];
     outputBuffer[m + 1] = new MyColor(r, g, b, a);
     byteIndex += 4;
     //------------------------------------
     //newline
     tmpY++;
     byteIndex = (tmpY * stride) + (cX * 4);
     //------------------------------------
     b = buffer[byteIndex];
     g = buffer[byteIndex + 1];
     r = buffer[byteIndex + 2];
     a = buffer[byteIndex + 3];
     outputBuffer[m + 2] = new MyColor(r, g, b, a);
     byteIndex += 4;
     //------------------------------------
     b = buffer[byteIndex];
     g = buffer[byteIndex + 1];
     r = buffer[byteIndex + 2];
     a = buffer[byteIndex + 3];
     outputBuffer[m + 3] = new MyColor(r, g, b, a);
     byteIndex += 4;
 }