//public bool forTesting = false;

    private void Awake()
    {
        colorHandler = FindObjectOfType <ColorHandler>();
        pauseBlocker = FindObjectOfType <PauseBlocker>();
        gameLoop     = FindObjectOfType <GameLoop>();
        grid         = GetComponent <CellsGrid>();
    }
Exemple #2
0
    private void ChangePlayerColor()
    {
        colorHandler = FindObjectOfType <ColorHandler>();
        Color paintColor = GetComponent <MeshRenderer>().material.color;

        colorHandler.PlayerGainColor(paintColor);
    }
        public override void ForEvery(Tile tile)
        {
            tile.Hex.ToggleGraphics(0.2);
            tile.Hex.ToggleOpenTile();
            tile.Hex.ToggleTileName();
            tile.Hex.TogglePlayerIcon();

            HexagonTile hex = tile.Hex;

            if (tile is Landscape)
            {
                hex.Polygon.Fill = Brushes.Black;
            }
            if (tile is City city)
            {
                if (city.Government != null)
                {
                    hex.Polygon.Fill = ColorHandler.ColorFromRGB(city.Government.RulingParties[0].Color);
                }
                else
                {
                    hex.Polygon.Fill = Brushes.DarkSlateGray;
                }
            }
        }
Exemple #4
0
 private void BRD_Action_PointerExited(object sender, PointerRoutedEventArgs e)
 {
     if (!IsSelected)
     {
         BRD_Action.Background = new SolidColorBrush(ColorHandler.FromHex("#7FFFFFFF"));
     }
 }
Exemple #5
0
        private Color GetColor(double h)
        {
            //int s = i / 256;
            //int j = i % 256;

            //switch (s)
            //{
            //    case 0:
            //        return Color.FromArgb(255, j, 0);

            //    case 1:
            //        return Color.FromArgb(255 - j, 255, 0);

            //    case 2:
            //        return Color.FromArgb(0, 255, j);

            //    case 3:
            //        return Color.FromArgb(0, 255 - j, 255);

            //    default:
            //        return Color.Black;
            //}

            return(ColorHandler.HSVtoColor(h, 1, 1));
        }
        private Border CreateUnit(Unit unit)
        {
            UnitCounter counter = new UnitCounter();

            //counter.lbl_unit_type.Content = unit.Symbol;
            counter.img_unit_size.Source    = unit.Symbol;
            counter.img_unit_counter.Source = Images.IconQuestionmark;
            if (unit.Color != null)
            {
                counter.border_unit.Background = ColorHandler.ColorFromRGB(unit.Color);
            }

            counter.img_unit_counter.Source = unit.IconCounter;

            string tt = unit.Name + "\n";

            if (unit.Owner != null)
            {
                tt += "Besitzer von " + unit.Owner.Name + "\n";
            }
            if (unit.Commander != null)
            {
                tt += "Unter kontrolle von " + unit.Commander.Name;
            }
            counter.border_unit.ToolTip = tt;

            Border border = (Border)SubWindow.CopyFrom(counter.border_unit);

            unit.BorderParent = border;
            border.Tag        = unit;
            border.MouseUp   += UnitCounterClick;
            return(border);
        }
 public void ToggleProvinceColor()
 {
     if (Tile.Owner != null)
     {
         Polygon.Fill = ColorHandler.ColorFromRGB(Color);
     }
 }
Exemple #8
0
    void Awake()
    {
        // register our game
        GSClient.Instance.RegisterGame("UNITY-GAMESENSE-APP-SCRIPTED", "Scripted Gamesense App", "LegitDevInc");

        ScreenHandler  screenHandler      = OLEDHandlerExamples();
        ColorHandler   rangedColorHandler = RangedColorHandler();
        ColorHandler   staticColorHandler = StaticColorHandler();
        TactileHandler tactileHandler     = StaticTactileHandler();

        // bind our event with the handler
        GSClient.Instance.BindEvent(
            "RANGED-EVENT",                                             // event name
            0,                                                          // min value
            100,                                                        // max value
            EventIconId.Default,                                        // icon id
            new AbstractHandler[] { rangedColorHandler, screenHandler } // array of handlers
            );

        GSClient.Instance.BindEvent(
            "BINARY-EVENT",                                              // event name
            0,                                                           // min value
            1,                                                           // max value
            EventIconId.Default,                                         // icon id
            new AbstractHandler[] { tactileHandler, staticColorHandler } // array of handlers
            );
    }
Exemple #9
0
 private void Start()
 {
     colorHandler    = FindObjectOfType <ColorHandler>();
     myMeshRenderer  = GetComponent <MeshRenderer>();
     myBoxCollider2D = GetComponent <BoxCollider2D>();
     audioSource     = GetComponent <AudioSource>();
 }
Exemple #10
0
 private void UserControl_PointerEntered(object sender, PointerRoutedEventArgs e)
 {
     if (!IsSelected)
     {
         BRD_BTN_Main.Background = new SolidColorBrush(ColorHandler.FromHex(resourceLoader.GetString("BTN_Action_Pointer_Entered_BGColor")));
     }
 }
Exemple #11
0
        //- Constructor
        public MapMode()
        {
            GuiBorder = new Border
            {
                BorderBrush     = ColorHandler.ColorFromHex("FFCBA112"),
                BorderThickness = new System.Windows.Thickness(2),
                CornerRadius    = new System.Windows.CornerRadius(25),
                Width           = 30,
                Height          = 30,
                Background      = ColorHandler.ColorFromHex("FF4C518B"),
                Margin          = new System.Windows.Thickness(0, 0, 4, 0)
            };

            Button btn = new Button
            {
                Background  = null,
                BorderBrush = null,
                Foreground  = null
            };

            btn.Click      += Click;
            GuiBorder.Child = btn;

            Image img = new Image
            {
                Source = Icon,
                Margin = new System.Windows.Thickness(-3)
            };

            btn.Content = img;
        }
Exemple #12
0
    private void CalcCoordsAndUpdate(ColorHandler.HSV HSV)
    {
        // Convert color to real-world coordinates and then calculate
        // the various points. HSV.Hue represents the degrees (0 to 360),
        // HSV.Saturation represents the radius.
        // This procedure doesn't draw anything--it simply
        // updates class-level variables. The UpdateDisplay
        // procedure uses these values to update the screen.

        // Given the angle (HSV.Hue), and distance from
        // the center (HSV.Saturation), and the center,
        // calculate the point corresponding to
        // the selected color, on the color wheel.
        colorPoint = GetPoint((double)HSV.Hue / 255 * 360,
                              (double)HSV.Saturation / 255 * radius,
                              centerPoint);

        // Given the brightness (HSV.value), calculate the
        // point corresponding to the brightness indicator.
        brightnessPoint = CalcBrightnessPoint(HSV.value);

        // Store information about the selected color.
        brightness    = HSV.value;
        selectedColor = ColorHandler.HSVtoColor(HSV);
        RGB           = ColorHandler.HSVtoRGB(HSV);

        // The full color is the same as HSV, except that the
        // brightness is set to full (255). This is the top-most
        // color in the brightness gradient.
        fullColor = ColorHandler.HSVtoColor(HSV.Hue, HSV.Saturation, 255);
    }
            public static ColorHandler Create(DeviceZone.AbstractIlluminationDevice_Zone dz, IlluminationMode mode, ColorStatic color)
            {
                ColorHandler ch = Create(dz, mode);

                ch.color_static = color;
                return(ch);
            }
 public void ToggleCountryColor()
 {
     if (Tile.CountryOwner != null)
     {
         Polygon.Fill = ColorHandler.ColorFromRGB(Tile.CountryOwner.RGBColor);
     }
 }
Exemple #15
0
        public void BindData(Tenant project, List <Twin> twins)
        {
            if (project != null)
            {
                Project = project;
                Twins   = twins;

                TB_Title.Text     = Project.Name;
                TB_Hostname.Text  = Project.Hostnames[0];
                TB_NProjects.Text = Twins.Count.ToString(CultureInfo.InvariantCulture);

                RC_Color.Fill   = new SolidColorBrush(ColorHandler.FromHex(project.FillColor, project.FillOpacity * 100));
                RC_Color.Stroke = new SolidColorBrush(ColorHandler.FromHex(project.FillColor));

                //BD_Actions_Main_Inner.Background = new SolidColorBrush(ColorHandler.FromHex(resourceLoader.GetString("BRD_Light_BGColor_Selected")));
                //IMG_Main.Source = new BitmapImage(new Uri(resourceLoader.GetString("BRD_Actions_Devices_IMG_Selected")));

                //CTRL_Action_REG.BindaData();
                //CTRL_Action_RREG.BindaData();
                //CTRL_Action_UPD.BindaData();

                //CTRL_Action_PHIGH.BindaData();
                //CTRL_Action_PF.BindaData();
                //CTRL_Action_PLOW.BindaData();

                //CTRL_Action_TEL0.BindaData();
                //CTRL_Action_TEL50.BindaData();
                //CTRL_Action_TEL100.BindaData();

                //BindData_Devices(project.FillColor);

                //IsVisible = true;
            }
        }
Exemple #16
0
    // Start is called before the first frame update
    void Awake()
    {
        boxes = new List <GameObject>();
        float startPosX = -(lvlSize / 2f) * boxSize;
        float startPosY = -(lvlSize / 2f) * boxSize;

        for (int x = 0; x < lvlSize; x++)
        {
            for (int y = 0; y < lvlSize; y++)
            {
                GameObject   newBox      = Instantiate(paintBoxPrefab, new Vector2(startPosX + (x * boxSize), startPosY + (y * boxSize)), Quaternion.identity);
                float        rand        = Random.Range(0f, 1f);
                ColorHandler currHandler = newBox.GetComponent <ColorHandler>();
                if (rand < 0.5f)
                {
                    currHandler.SetGoalColor(color1);
                }
                else
                {
                    currHandler.SetGoalColor(color2);
                }
                boxes.Add(newBox);
            }
        }
    }
Exemple #17
0
        public void BindData(Tenant project, List <Twin> twins)
        {
            if (project != null)
            {
                Project = project;

                Twins = twins;

                TB_Title.Text    = Project.Name;
                TB_Hostname.Text = Project.Hostnames[0];
                //TB_NProjects.Text = _Project.Items.Count.ToString(CultureInfo.InvariantCulture);
                TB_ProjectInfo_Main_NProjects.Text = twins.Count.ToString(CultureInfo.InvariantCulture);

                RC_Color.Fill   = new SolidColorBrush(ColorHandler.FromHex(project.FillColor, project.FillOpacity * 100));
                RC_Color.Stroke = new SolidColorBrush(ColorHandler.FromHex(project.FillColor));


                BRD_NDevices_Top.BorderBrush = new SolidColorBrush(ColorHandler.FromHex(project.FillColor));
                //BRD_NDevices_Top.Background = new SolidColorBrush(ColorHandler.FromHex(project.FillColor, project.FillOpacity * 100));

                //BindData_Devices(project.FillColor);

                IsVisible = true;
            }
        }
Exemple #18
0
    private void Start()
    {
        colorHandler = FindObjectOfType <ColorHandler>();

        animator   = GetComponent <Animator>();
        interactor = GetComponent <BucketInteractor>();
        source     = GetComponent <ScoreSource>();
    }
 private void WhiteOut()
 {
     foreach (var box in boxes)
     {
         ColorHandler currHandler = box.GetComponent <ColorHandler>();
         currHandler.ResetBox();
     }
 }
            public static ColorHandler Create(DeviceZone.AbstractIlluminationDevice_Zone dz, IlluminationMode mode, ColorGradient color, RateStatic rate)
            {
                ColorHandler ch = Create(dz, mode);

                ch.color_gradient = color;
                ch.rate_static    = rate;
                return(ch);
            }
            public static ColorHandler Create(DeviceZone.AbstractIlluminationDevice_Zone dz, IlluminationMode mode, ColorRanges color, RateRange rate)
            {
                ColorHandler ch = Create(dz, mode);

                ch.color_range = color;
                ch.rate_range  = rate;
                return(ch);
            }
Exemple #22
0
 public void Draw(Graphics g, ColorHandler.RGB RGB)
 {
     // Given RGB values, calculate HSV and then update the screen.
     this.g   = g;
     this.HSV = ColorHandler.RGBtoHSV(RGB);
     CalcCoordsAndUpdate(this.HSV);
     UpdateDisplay();
 }
        internal void OnButtonClick(string btnName, object additionalObject)
        {
            switch (btnName)
            {
            case "SentPackages":

                if (!_mono.HasItems())
                {
                    QuickLogger.Info($"There are no items to ship canceling shipment", true);
                    return;
                }

                TargetScreen();
                break;

            case "OpenContainer":
                _mono.OpenStorage();
                _animatorController.OpenDoors();
                break;

            case "CancelBTN":
                MainScreen();
                break;

            case "ColorItem":
                var color = (Color)additionalObject;
                ColorHandler.ChangeBodyColor("AlterraShipping_BaseColor", color, _mono.gameObject);
                QuickLogger.Debug($"{_mono.gameObject.name} Color Changed to {color.ToString()}");
                _mono.SetCurrentBodyColor(color);
                break;

            case "ColorPickerBTN":
                ColorPickerScreen();
                break;

            case "ColorCancelBTN":
                MainScreen();
                break;

            case "ShippingContainer":
                var target = additionalObject as AlterraShippingTarget;

                if (target == null)
                {
                    QuickLogger.Error <AlterraShippingDisplay>("The target shipping container returned null");
                    return;
                }

                if (target.IsReceivingTransfer || target.IsFull())
                {
                    QuickLogger.Message($"Target Inventory doesn't have enough free slots or is receiving a shipment", true);
                    return;
                }

                ShippingScreen(target);
                break;
            }
        }
Exemple #24
0
    public RandomColorizeStateMachine(ColorHandler infos)
        : base(infos)
    {
        RegisterState(new DisplayColorState());
        RegisterState(new GenerateColorState());
        RegisterState(new ValidateColorState());

        SetInitialState(RandomColorizeStateTokens.GenerateColor);
    }
Exemple #25
0
        public void SetColorAtPoint(Color color, Vector3 point)
        {
            if (OnColorSet != null)
            {
                ColorHandler dispatch = OnColorSet;

                dispatch(this, color, point);
            }
        }
        public void Test_General()
        {
            Assert.Throws(typeof(ArgumentNullException), () => { new ObjHandler(null); });

            var handler = new ColorHandler(Color.PaleVioletRed);

            Assert.IsNotNull(handler);
            Assert.AreEqual(Color.PaleVioletRed, handler.Handle);
        }
Exemple #27
0
 public void Reset()
 {
     IsSelected            = false;
     BRD_Action.Background = new SolidColorBrush(ColorHandler.FromHex("#7FFFFFFF"));
     IMG_Action.Source     = new BitmapImage()
     {
         UriSource = new Uri(IMGSource)
     };
 }
Exemple #28
0
    public static ColorHandler ColorHandlerFactory(String color, ref int i, ref string str)
    {
        ColorHandler handler = Handlers[color];

        handler.i   = i;
        handler.str = str;
        handler.Handle();
        return(handler);
    }
            private static ColorHandler Create(DeviceZone.AbstractIlluminationDevice_Zone dz, IlluminationMode mode)
            {
                ColorHandler ch = _new();

                ch.deviceZone = dz;
                ch.mode       = mode;
                ch._rateMode  = RateMode.None;
                return(ch);
            }
Exemple #30
0
        public static void SetParent(Form1 parent)
        {
            Parent = parent;

            // Laddar in färgerna, kanke inte rätt ställe att göra så ?
            colorFactory = ColorHandler.Instance;

            colors = colorFactory.GetColorTheme();
        }
 private void SetHSVLabels(ColorHandler.HSV HSV)
 {
     RefreshText(lblHue, HSV.Hue);
     RefreshText(lblSaturation, HSV.Saturation);
     RefreshText(lblBrightness, HSV.value);
 }
 private void SetRGB(ColorHandler.RGB RGB)
 {
     // Update the RGB values on the form.
     RefreshValue(hsbRed, RGB.Red);
     RefreshValue(hsbBlue, RGB.Blue);
     RefreshValue(hsbGreen, RGB.Green);
     SetRGBLabels(RGB);
 }
 private void SetRGB(ColorHandler.RGB RGB)
 {
     // Update the RGB values on the form.
     RefreshValue(redSc, RGB.Red);
     RefreshValue(blueSC, RGB.Blue);
     RefreshValue(greenSc, RGB.Green);
     SetRGBLabels(RGB);
     Elements.arduino.setColor(this.Color);
 }
 private void SetHSV(ColorHandler.HSV HSV)
 {
     // Update the HSV values on the form.
     RefreshValue(Hue, HSV.Hue);
     RefreshValue(Saturation, HSV.Saturation);
     RefreshValue(Brightness, HSV.value);
     SetHSVLabels(HSV);
     Elements.arduino.setColor(this.Color);
 }
Exemple #35
0
 public void Draw(Graphics g, ColorHandler.HSV HSV)
 {
     // Given HSV values, update the screen.
     this.g = g;
     this.HSV = HSV;
     CalcCoordsAndUpdate(this.HSV);
     UpdateDisplay();
 }
 private void SetRGB( ColorHandler.RGB RGB)
 {
     // Update the RGB values on the form, but don't trigger
       // the ValueChanged event of the form. The isInUpdate
       // variable ensures that the event procedures
       // exit without doing anything.
       isInUpdate = true;
       RefreshValue(nudRed, RGB.Red);
       RefreshValue(nudBlue, RGB.Blue);
       RefreshValue(nudGreen, RGB.Green);
       RGBOUT = RGB;
       isInUpdate = false;
 }
 private void SetHSV(ColorHandler.HSV HSV)
 {
     // Update the HSV values on the form, but don't trigger
       // the ValueChanged event of the form. The isInUpdate
       // variable ensures that the event procedures
       // exit without doing anything.
       isInUpdate = true;
       RefreshValue(nudHue, HSV.Hue);
       RefreshValue(nudSaturation, HSV.Saturation);
       RefreshValue(nudBrightness, HSV.value);
       isInUpdate = false;
 }
Exemple #38
0
 public void Draw(Graphics g, ColorHandler.RGB RGB)
 {
     // Given RGB values, calculate HSV and then update the screen.
     this.g = g;
     this.HSV = ColorHandler.RGBtoHSV(RGB);
     CalcCoordsAndUpdate(this.HSV);
     UpdateDisplay();
 }
Exemple #39
0
 protected void OnColorChanged(ColorHandler.RGB RGB, ColorHandler.HSV HSV)
 {
     ColorChangedEventArgs e = new ColorChangedEventArgs(RGB, HSV);
     ColorChanged(this, e);
 }
 private void SetHSV( ColorHandler.HSV HSV)
 {
     // Update the HSV values on the form.
     RefreshValue(hsbHue, HSV.Hue);
     RefreshValue(hsbSaturation, HSV.Saturation);
     RefreshValue(hsbBrightness, HSV.value);
     SetHSVLabels(HSV);
 }
 public ColorChangedEventArgs(ColorHandler.RGB RGB, ColorHandler.HSV HSV)
 {
     mRGB = RGB;
     mHSV = HSV;
 }
Exemple #42
0
 protected void OnColorChanged(ColorHandler.ARGB argb, ColorHandler.HSV HSV)
 {
     ColorChangedEventArgs e = new ColorChangedEventArgs(argb, HSV);
     ColorChanged(this, e);
 }
 public ColorChangedEventArgs( ColorHandler.ARGB argb,  ColorHandler.HSV HSV)
 {
     this.ARGB = argb;
     this.HSV = HSV;
 }
 private void SetHSVLabels(ColorHandler.HSV HSV)
 {
     RefreshText(hueLbl, HSV.Hue);
     RefreshText(satLbl, HSV.Saturation);
     RefreshText(britlbl, HSV.value);
 }
 private void SetRGBLabels(ColorHandler.RGB RGB)
 {
     RefreshText(lblRed, RGB.Red);
     RefreshText(lblBlue, RGB.Blue);
     RefreshText(lblGreen, RGB.Green);
 }
 private void SetRGBLabels(ColorHandler.RGB RGB)
 {
     RefreshText(redlbl, RGB.Red);
     RefreshText(blueLbl, RGB.Blue);
     RefreshText(greenLbl, RGB.Green);
 }
Exemple #47
0
    private void CalcCoordsAndUpdate(ColorHandler.HSV HSV)
    {
        // Convert color to real-world coordinates and then calculate
        // the various points. HSV.Hue represents the degrees (0 to 360),
        // HSV.Saturation represents the radius.
        // This procedure doesn't draw anything--it simply
        // updates class-level variables. The UpdateDisplay
        // procedure uses these values to update the screen.

        // Given the angle (HSV.Hue), and distance from
        // the center (HSV.Saturation), and the center,
        // calculate the point corresponding to
        // the selected color, on the color wheel.
        colorPoint = GetPoint((double)HSV.Hue / 255 * 360,
            (double)HSV.Saturation / 255 * radius,
            centerPoint);

        // Given the brightness (HSV.value), calculate the
        // point corresponding to the brightness indicator.
        brightnessPoint = CalcBrightnessPoint(HSV.value);

        // Store information about the selected color.
        brightness = HSV.value;
        selectedColor = ColorHandler.HSVtoColor(HSV);
        RGB = ColorHandler.HSVtoRGB(HSV);

        // The full color is the same as HSV, except that the
        // brightness is set to full (255). This is the top-most
        // color in the brightness gradient.
        fullColor = ColorHandler.HSVtoColor(255, HSV.Hue, HSV.Saturation, 255);
    }