Example #1
0
    public static Object PreviewHex(Colors color)
    {
        switch (color)
        {
        case Colors.Red:
            return(Resources.Load("Prefabs/Shape1Preview"));

        case Colors.Orange:
            return(Resources.Load("Prefabs/OrangePreview"));

        case Colors.Yellow:
            return(Resources.Load("Prefabs/YellowPreview"));

        case Colors.Green:
            return(Resources.Load("Prefabs/GreenPreview"));

        case Colors.Blue:
            return(Resources.Load("Prefabs/BluePreview"));

        case Colors.Violet:
            return(Resources.Load("Prefabs/VioletPreview"));

        default:
            return(Resources.Load("Prefabs/Blank"));
        }
    }
Example #2
0
    public static Object SolidHex(Colors color)
    {
        switch (color)
        {
        case Colors.Red:
            return(Resources.Load("Prefabs/Red"));

        case Colors.Orange:
            return(Resources.Load("Prefabs/Orange"));

        case Colors.Yellow:
            return(Resources.Load("Prefabs/Yellow"));

        case Colors.Green:
            return(Resources.Load("Prefabs/Green"));

        case Colors.Blue:
            return(Resources.Load("Prefabs/Blue"));

        case Colors.Violet:
            return(Resources.Load("Prefabs/Violet"));

        default:
            return(Resources.Load("Prefabs/Blank"));
        }
    }
Example #3
0
//	private int GetLayerMask(Colors col){
//		int map = LayerMask.GetMask ("Map");
//		switch(col){
//			case Colors.Red:
//				return ~(LayerMask.GetMask ("Red") | LayerMask.GetMask ("Map"));
//			case Colors.Orange:
//				return ~(LayerMask.GetMask ("Orange") | LayerMask.GetMask ("Map"));
//			case Colors.Yellow:
//				return ~(LayerMask.GetMask ("Yellow") | LayerMask.GetMask ("Map"));
//			case Colors.Green:
//				return ~(LayerMask.GetMask ("Green") | LayerMask.GetMask ("Map"));
//			case Colors.Blue:
//				return ~(LayerMask.GetMask ("Blue") | LayerMask.GetMask ("Map"));
//			case Colors.Violet:
//				return ~(LayerMask.GetMask ("Violet") | LayerMask.GetMask ("Map"));
//			default:
//				return -1;
//		}
//	}

    private int GetLayerMask(Colors col)
    {
        int map = LayerMask.GetMask("Map");

        switch (col)
        {
        case Colors.Red:
            return(~(LayerMask.GetMask("Red")));

        case Colors.Orange:
            return(~(LayerMask.GetMask("Orange")));

        case Colors.Yellow:
            return(~(LayerMask.GetMask("Yellow")));

        case Colors.Green:
            return(~(LayerMask.GetMask("Green")));

        case Colors.Blue:
            return(~(LayerMask.GetMask("Blue")));

        case Colors.Violet:
            return(~(LayerMask.GetMask("Violet")));

        default:
            return(-1);
        }
    }
 public RegionSetting(Constants.Regions region, Constants.Intensities intensity,
                      Constants.Colors primaryColor,
                      Constants.Colors secondaryColor)
 {
     Region         = region;
     Intensity      = intensity;
     PrimaryColor   = primaryColor;
     SecondaryColor = secondaryColor;
 }
Example #5
0
        private void ConvertAndDisplay(int receivedSize)
        {
            string data = Encoding.ASCII.GetString(_buffer, 0, receivedSize);

            Debug.WriteLine(data.Length);
            List <UNOCard> deserializedProduct = JsonConvert.DeserializeObject <List <UNOCard> >(data);

            Debug.WriteLine(deserializedProduct[0].GetColor());
            Constants.Colors colors = (Constants.Colors)deserializedProduct[0].GetColor();
            Debug.WriteLine(colors.ToString());
        }
Example #6
0
        private void OnUserCardsReceived(object sender, ClientStateEventArgs e)
        {
            StringBuilder stringBuilder = new StringBuilder();

            foreach (UNOCard card in e.clientState.userCards)
            {
                int data = card.GetColor();
                Constants.Colors colors = (Constants.Colors)data;
                stringBuilder.Append(colors.ToString());
            }
            uiUpdater.SetText(stringBuilder.ToString());
            UNOCard _card = e.clientState.userCards[0];
            string  text  = GetImageName(_card);

            //uiUpdater.SetCard(text);
            backgroundWorker1.RunWorkerAsync(text);
        }
Example #7
0
        private void ColorButtonClick(object sender, RoutedEventArgs e)
        {
            Constants.Regions region;
            string            buttonName = ((Button)sender).Name;

            //Get region according to button name
            if (buttonName.Contains("Left"))
            {
                region = Constants.Regions.Left;
            }
            else if (buttonName.Contains("Middle"))
            {
                region = Constants.Regions.Middle;
            }
            else
            {
                region = Constants.Regions.Right;
            }


            //Get color
            Constants.Colors color = (from c in Enum.GetNames(typeof(Constants.Colors))
                                      where buttonName.Contains(c)
                                      select(Constants.Colors) Enum.Parse(typeof(Constants.Colors), c)).FirstOrDefault();

            //Get intensity
            Constants.Intensities intensity = (from i in Enum.GetNames(typeof(Constants.Intensities))
                                               where buttonName.Contains(i)
                                               select(Constants.Intensities) Enum.Parse(typeof(Constants.Intensities), i)).FirstOrDefault();

            //Get primary or secondary according to array
            bool isPrimary = _isPrimaryPage[(int)region - 1];

            //Store it
            switch (region)
            {
            case Constants.Regions.Left:
                _leftRegionSetting.Intensity = intensity;
                if (isPrimary)
                {
                    _leftRegionSetting.PrimaryColor = color;
                }
                else
                {
                    _leftRegionSetting.SecondaryColor = color;
                }
                break;

            case Constants.Regions.Middle:
                _middleRegionSetting.Intensity = intensity;
                if (isPrimary)
                {
                    _middleRegionSetting.PrimaryColor = color;
                }
                else
                {
                    _middleRegionSetting.SecondaryColor = color;
                }
                break;

            case Constants.Regions.Right:
                _rightRegionSetting.Intensity = intensity;
                if (isPrimary)
                {
                    _rightRegionSetting.PrimaryColor = color;
                }
                else
                {
                    _rightRegionSetting.SecondaryColor = color;
                }
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            TransferSettingsToKeyboard();
            SetSelectedButtons();
        }