Example #1
0
        private void DisplayStats()
        {
            SetColor.SetTextColor('#');

            Console.SetCursorPosition(1, 17);
            Console.WriteLine($"Hunger: {player.Hunger}   ");

            if (player.Backpack != null)
            {
                Console.SetCursorPosition(1, 18);
                Console.WriteLine($"Antal item backpack: {player.Backpack.Count()}  ");
                Console.SetCursorPosition(1, 19);
                Console.WriteLine("                                   ");
                Console.SetCursorPosition(1, 19);

                foreach (var item in player.Backpack.Take(3))
                {
                    Console.Write($"{item.Name} ");
                }
            }
            if (enemyPlayer.Backpack != null)
            {
                Console.SetCursorPosition(1, 23);
                Console.WriteLine($"Snodda items: {enemyPlayer.Backpack.Count()}  ");
            }

            Console.SetCursorPosition(1, 20);
            Console.WriteLine($"Monster kvar: {CountRemainingMonsters()}  ");
            Console.SetCursorPosition(1, 21);
            Console.WriteLine($"Bossar kvar: {CountRemainingBosses()}  ");
            SetColor.SetTextColor('d');
        }
Example #2
0
    // Animate row
    public static void PlayClearAnimationFromRow()
    {
        float delay = 0f;

        foreach (int y in GameGrid.whatRowIsFilled)
        {
            Debug.Log(y);
            for (int x = GameGrid.width - 1; x >= 0; x--)
            {
                if (SetColor.GetDarkMode() == true)
                {
                    GameGrid.grid[x, y].gameObject.GetComponentInChildren <Animator>().Play("BlockClearDark", 0, delay); // _name, _layer, _delay
                    delay += .1f;
                    //GameGrid.grid[x, y].gameObject.GetComponentInChildren<Animator>().enabled = false;
                }
                else
                {
                    GameGrid.grid[x, y].gameObject.GetComponentInChildren <Animator>().Play("BlockClearLight", 0, delay); // _name, _layer, _delay
                    delay += .1f;
                    //GameGrid.grid[x, y].gameObject.GetComponentInChildren<Animator>().enabled = false;
                }
            }
        }

        runAnimationScript = false;
    }
Example #3
0
        /// <summary>
        /// Updates the pin data.
        /// </summary>
        public async void UpdatePinData()
        {
            try
            {
                FirebaseHelper firebaseHelper = new FirebaseHelper();

                //// Gets current user id
                var userid = DependencyService.Get <IFirebaseAuthenticator>().UserId();

                ////Gets the notes data
                NotesData notesData = await firebaseHelper.GetNotesData(this.value, userid);

                txtTitle.Text        = notesData.Title;
                txtNotes.Text        = notesData.Notes;
                this.noteColor       = notesData.ColorNote;
                this.listLabel       = notesData.LabelData;
                this.area            = notesData.Area;
                this.BackgroundColor = Color.FromHex(SetColor.GetHexColor(notesData));
                this.collaborate     = notesData.IsCollaborated;
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
Example #4
0
 private void Btn_MouseClick(object sender, MouseEventArgs e)
 {
     if (sender is Button)
     {
         Button btn = (Button)sender;
         if (e.Button == MouseButtons.Left)
         {
             if (btn.Tag is Color)
             {
                 Color c = (Color)btn.Tag;
                 foreach (Button b in buttons)
                 {
                     b.BackColor = Style.Default.MenuBackground;
                 }
                 btn.BackColor = Style.Default.Selection;
                 SetColor?.Invoke(c);
                 selectedColor = c;
             }
         }
         else if (e.Button == MouseButtons.Right)
         {
             lsel = buttons.IndexOf(btn);
             penCtx.Show(Cursor.Position);
         }
     }
 }
Example #5
0
    private static void RunBgCol(MonoBehaviour mono)
    {
        float wait  = 0.0f;
        int   reset = 0;

        foreach (int a in bg_cols)
        {
            // Run animation
            float loc = -PlayAtLocation(a / 10);
            //if (a % 10 == rowLoc) loc += PlayAtLocation(a / 10);
            if (SetColor.GetDarkMode() == true)
            {
                bg_grid[a].GetComponent <Animator>().enabled = true;
                bg_grid[a].GetComponent <Animator>().Play("BlockClearDark", 0, loc);
            }
            else
            {
                bg_grid[a].GetComponent <Animator>().enabled = true;
                bg_grid[a].GetComponent <Animator>().Play("BlockClearLight", 0, loc);
            }
            // Delete the changed block on the MeshRender.materal[1] on the bg
            MeshRenderer bgBlock = bg_grid[a].GetComponent <MeshRenderer>();
            mono.StartCoroutine(DeleteColorChange(bgBlock, wait));
            mono.StartCoroutine(DisableAnimator(bg_grid[a].GetComponent <Animator>(), wait + 1f).GetEnumerator());

            wait += changeTranstionalTime;

            // Reset the time every col change for multiple clears in one play
            if (++reset % 10 == 0)
            {
                wait = 0.0f;
            }
        }
    }
Example #6
0
    // Start is called before the first frame update
    void Start()
    {
        //WindowManager.instance.ScreenSizeChangeEvent += Instance_ScreenSizeChangeEvent;

        DetectPossibleMoves.SetBooleans();
        GamePieces.FindGameBlocks();
        GamePieces.FindGamePieces();

        clickAndDropScript = gameObject.GetComponent <ClickAndDrop>();
        gameOverCanvas     = GameObject.FindGameObjectWithTag("GameOverCanvas");
        restartButton      = GameObject.FindGameObjectWithTag("RestartButton");
        changeColorButton  = GameObject.FindGameObjectWithTag("ChangeColor");
        highScoreIcon      = GameObject.FindGameObjectWithTag("HighScoreIcon");

        background = GameObject.FindGameObjectWithTag("BlurBG");

        gameOverCanvas.SetActive(false);
        restartButton.SetActive(false);
        changeColorButton.SetActive(true);
        background.SetActive(false);
        highScoreIcon.SetActive(true);


        // Change BG
        var camera = (Camera)FindObjectOfType(typeof(Camera));

        camera.backgroundColor = SetColor.GetColor("Background");

        // Change Grid
        AnimateGrid.SetGrid();

        UpdateColor();
    }
Example #7
0
        public void SetColor(double hue, double saturation, double lightness, int lightIx, uint source, byte sequence)
        {
            double[] hsb = LiFXUtils.HSL2HSB(hue, saturation, lightness);
            // нормирование значений
            // Hue: range 0 to 65535
            // Saturation: range 0 to 65535
            // Brightness: range 0 to 65535
            // Kelvin: range 2500° (warm) to 9000° (cool)
            UInt16 Hue = (UInt16)((hsb[0] * 65535) / 360.0);
            //Console.WriteLine($"HueUint16 {Hue}");
            UInt16   Sat     = (UInt16)(hsb[1] * 65535);
            UInt16   Bri     = (UInt16)(hsb[2] * 65535);
            SetColor payload = new SetColor(Hue, Sat, Bri, 2500, 0);
            Message  msg     = new Message();

            msg.Header.Target       = LE_EntryList[lightIx].MacUInt64;
            msg.Header.Tagged       = false;
            msg.Header.Addressable  = true;
            msg.Header.Res_required = false;
            msg.Ack_required        = true;
            msg.Header.Source       = source;
            msg.Header.MessageType  = MsgTypeEnum.SetColor;
            msg.Header.Sequence     = sequence;
            msg.Payload             = payload;
            SendMessage(LE_EntryList[lightIx].Channel.LE_EndPoint.IPAddress, msg.RawMessage);
        }
Example #8
0
        private void DisplayPartOfWorld(Player character, int x, int y)
        {
            Console.SetCursorPosition(x, y);
            Room room = world[x, y];

            if (character.X == x && character.Y == y)
            {
                SetColor.SetTextColor(character.Symbol);
                Console.Write(character.Symbol);
            }
            else if (room.WorldObject != null)
            {
                //SetColor.SetTextColor(room.WorldObject.Symbol);
                Console.Write(room.WorldObject.Symbol);
            }
            else if (room.Monster != null)
            {
                //SetColor.SetTextColor(room.Monster.Symbol);
                Console.Write(room.Monster.Symbol);
            }
            else if (room.Item != null)
            {
                // SetColor.SetTextColor(room.Item.Symbol);
                Console.Write(room.Item.Symbol);
            }
            else
            {
                // Console.ForegroundColor = ConsoleColor.Black;
                Console.Write(" ");
            }
        }
Example #9
0
        public void SetColor(IPAddress ipAddress, UInt64 mac, double h, double s, double l, int transitiontime = 0)
        {
            double[] hsb = LiFXUtils.HSL2HSB(h, s, l);

            // нормирование значений
            // Hue: range 0 to 65535
            // Saturation: range 0 to 65535
            // Brightness: range 0 to 65535
            // Kelvin: range 2500° (warm) to 9000° (cool)

            UInt16 Hue = (UInt16)((hsb[0] * 65535) / 360.0);
            //Console.WriteLine($"HueUint16 {Hue}");
            UInt16   Sat     = (UInt16)(hsb[1] * 65535);
            UInt16   Bri     = (UInt16)(hsb[2] * 65535);
            SetColor payload = new SetColor(Hue, Sat, Bri, 2500, (ushort)transitiontime);
            Message  msg     = new Message();

            msg.Header.Target       = mac;
            msg.Header.Tagged       = false;
            msg.Header.Addressable  = true;
            msg.Header.Res_required = false;
            msg.Ack_required        = true;
            //msg.Header.Source = source;
            msg.Header.MessageType = MsgTypeEnum.SetColor;
            //msg.Header.Sequence = sequence;
            msg.Payload = payload;

            requestQueue.Enqueue(new MessageCmd(ipAddress, msg));

            //SendMessage(LE_EntryList[lightIx].Channel.LE_EndPoint.IPAddress, msg.RawMessage);
        }
Example #10
0
        private void Awake()
        {
            var image = GetComponent <Image>();

            if (image != null)
            {
                _getSprite = () => image.sprite;
                _setSprite = sp => image.sprite = sp;
                _getColor  = () => image.color;
                _setColor  = c => image.color = c;
                return;
            }

            var spriteRenderer = GetComponent <SpriteRenderer>();

            if (spriteRenderer != null)
            {
                _getSprite = () => spriteRenderer.sprite;
                _setSprite = sp => spriteRenderer.sprite = sp;
                _getColor  = () => spriteRenderer.color;
                _setColor  = c => spriteRenderer.color = c;
                return;
            }

            Debug.LogError(string.Format(
                               "Nova: ChangeSpriteWithFade should have Image or SpriteRenderer component attached." +
                               " Object name: {0}", gameObject.name));
        }
Example #11
0
    /// <summary>
    /// This resets the hud sprites in the character builder every time a slider moves.
    /// </summary>
    public void Refresh()
    {
        Destroy(head.gameObject);
        Destroy(headBack.gameObject);
        Destroy(body.gameObject);
        switch (HeadAnimate.index)
        {
        case 0:
            headBack = Instantiate(headSeedBack1);
            head     = Instantiate(headSeed1);
            break;

        case 1:
            headBack = Instantiate(headSeedBack2);
            head     = Instantiate(headSeed2);
            break;

        case 2:
            headBack = Instantiate(headSeedBack3);
            head     = Instantiate(headSeed3);
            break;

        case 3:
            headBack = Instantiate(headSeedBack4);
            head     = Instantiate(headSeed4);
            break;

        case 4:
            headBack = Instantiate(headSeedBack5);
            head     = Instantiate(headSeed5);
            break;
        }
        body = Instantiate(bodySeed);
    }
Example #12
0
 public ColorNode(Game game, String name, SetColor setColor, GetColor getColor)
 {
     m_game = game;
     m_name = name;
     m_setColorCallback = setColor;
     m_getColorCallback = getColor;
 }
Example #13
0
 void Start()
 {
     UpgradeManager      = GameObject.Find("UpgradeManager");
     _eventsystem        = UpgradeManager.GetComponent <EventSystem> ();
     _setcolor           = SetColorButton.GetComponent <SetColor> ();
     _bodycolorupgrade   = BodyColorManager.GetComponent <BodyColorUpgrade> ();
     _bumpercolorupgrade = BumperColorManager.GetComponent <BumperColorUpgrade> ();
 }
Example #14
0
    public void ChangeColors()
    {
        //SetColor.DarkMode = !SetColor.DarkMode;
        SetColor.WillChangeColor = true;

        SetColor.ChangeColorTheme();
        //Debug.Log(SetColor.GetDarkMode());

        //Debug.Log(SetColor.DarkMode);
    }
Example #15
0
    public void Init(int playerNum, Transform gun, float speed, Color color)
    {
        this.parentNum   = playerNum;
        this.gunForward  = -gun.forward;
        this.bulletSpeed = speed;
        //Rigidbody rigidbody = Instantiate(this.gameObject.GetComponent<Rigidbody>(), gun.transform.position, gun.transform.rotation) as Rigidbody;
        SetColor bulletColor = this.GetComponent <SetColor>();

        bulletColor.ColorSet(color);
    }
        public async void LocationArea(string Area)
        {
            var userid = DependencyService.Get <IFirebaseAuthenticator>().UserId();
            var notes  = await this.firebaseHelper.GetNotesData(value, userid);

            if (notes.Area != null)
            {
                var image = new Image
                {
                    Source            = "location.png",
                    HorizontalOptions = LayoutOptions.Start,
                    VerticalOptions   = LayoutOptions.Start,

                    HeightRequest = 13,
                    WidthRequest  = 13
                };
                var location = new Label
                {
                    Text = notes.Area,
                    HorizontalOptions = LayoutOptions.Start,
                    VerticalOptions   = LayoutOptions.Start,
                    FontSize          = 14,
                };
                StackLayout framelayout = new StackLayout()
                {
                    Spacing = 2,
                    Margin  = 1
                };
                var tapGestureRecognizer = new TapGestureRecognizer();
                framelayout.GestureRecognizers.Add(tapGestureRecognizer);
                framelayout.Children.Add(image);
                framelayout.Children.Add(location);
                var locationFrame = new Frame();
                locationFrame.CornerRadius  = 28;
                locationFrame.HeightRequest = 14;
                location.WidthRequest       = 50;
                locationFrame.BorderColor   = Color.Gray;
                locationFrame.Content       = framelayout;
                // locationFrame.Content = image;

                locationFrame.BackgroundColor = Color.FromHex(SetColor.GetHexColor(notes));

                tapGestureRecognizer.Tapped += (object sender, EventArgs args) =>
                {
                    StackLayout  stacklayout = (StackLayout)sender;
                    IList <View> item        = stacklayout.Children;

                    Navigation.PushAsync(new GeoLocation());
                };
                //layout.Children.Add(image);
                locationLayout.Children.Add(locationFrame);
            }
        }
    static void InitValfri()
    {
        ValfriStatic.MatrixOfPoints = DictToMatrix.GetMatrix(Dataset.ListOfPoints);
        ValfriStatic.Targets        = GetTargetFromDataSet(ValfriStatic.MatrixOfPoints);
        SetColor.Init(ValfriStatic.Targets);
        ValfriStatic.MatrixOfPoints = RemoveIndexAndTarget(ValfriStatic.MatrixOfPoints);

        Normalize.Initiate(ValfriStatic.MatrixOfPoints);
        ValfriStatic.NormalizedMatrixOfPoints = Normalize.Matrix(ValfriStatic.MatrixOfPoints);

        ValfriStatic.FeaturesToDisplay = Dataset.FeatureNames;
    }
Example #18
0
    public static Color GetColor(double target)
    {
        //if (target == 0)
        //    return Color.red;
        //else if (target == 1)
        //    return Color.blue;
        //else if (target == 2)
        //    return Color.green;
        //else
        //    return Color.red;

        return(SetColor.GetColor(target));
    }
Example #19
0
                public override Command Combine(Command other)
                {
                    SetColor otherCommand = other as SetColor;

                    if (otherCommand != null)
                    {
                        Color color = Color.FromArgb(
                            Math.Max(Color.R, otherCommand.Color.R),
                            Math.Max(Color.G, otherCommand.Color.G),
                            Math.Max(Color.B, otherCommand.Color.B)
                            );
                        return(new SetColor(color));
                    }
                    return(this);
                }
        static ConsoleHelper()
        {
            var bepinSafeConsole = typeof(BaseUnityPlugin).Assembly.GetType("BepInEx.ConsoleUtil.Kon", false, false);

            var bgColorProperty =
                bepinSafeConsole.GetProperty("BackgroundColor", BindingFlags.Static | BindingFlags.Public);
            var fgColorProperty =
                bepinSafeConsole.GetProperty("ForegroundColor", BindingFlags.Static | BindingFlags.Public);

            SetBackgroundColor = (SetColor)Delegate.CreateDelegate(typeof(SetColor), bgColorProperty.GetSetMethod());
            SetForegroundColor = (SetColor)Delegate.CreateDelegate(typeof(SetColor), fgColorProperty.GetSetMethod());

            GetForegroundColor = (GetColor)Delegate.CreateDelegate(typeof(GetColor), fgColorProperty.GetGetMethod());
            GetBackgroundColor = (GetColor)Delegate.CreateDelegate(typeof(GetColor), bgColorProperty.GetGetMethod());
        }
Example #21
0
 private void SetTraceItem_Click(object sender, EventArgs e)
 {
     if (!IsLoadDataSource())
     {
         return;
     }
     if (!PublicMethod.Instance.IsExecuteSystemCMD(""))
     {
         var tt = new SetColor();
         if (Application.ShowModalDialog(tt) == DialogResult.OK)
         {
             PublicMethod.Instance.traceColor = tt.ccolor;
         }
     }
 }
Example #22
0
    /// <summary>
    /// Creates a new SetColor based on the specified input text.
    /// </summary>
    /// <param name="input">The input text to get a match for. For example, "a.color = #ffffff".</param>
    /// <returns>Returns the new SetColor, or null if a no matches were found for the specified input.</returns>
    public static SetColor Create(string input)
    {
        const string pattern = @"^(?<vectorName>\w+).color\s*=\s*(?<hexCode>#([0-9a-f]){3}(([0-9a-f]){3})?)$";

        Regex           regex   = new Regex(pattern);
        MatchCollection matches = regex.Matches(input);

        if (matches.Count == 0)
        {
            return(null);
        }

        SetColor setColor = new SetColor();

        setColor.vectorName = RegexHelper.GetValue <string>(matches, "vectorName");
        setColor.hexCode    = RegexHelper.GetValue <string>(matches, "hexCode");
        return(setColor);
    }
Example #23
0
        /// <summary>
        /// archive data.
        /// </summary>
        public async void UnArchiveData()
        {
            FirebaseHelper firebaseHelper = new FirebaseHelper();

            //// Gets the current user id
            var userid = DependencyService.Get <IFirebaseAuthenticator>().UserId();

            //// Gets all notes data from firebase
            NotesData notesData = await firebaseHelper.GetNotesData(this.val, userid);

            txtTitle.Text        = notesData.Title;
            txtNotes.Text        = notesData.Notes;
            this.noteColor       = notesData.ColorNote;
            this.labelList       = notesData.LabelData;
            this.area            = notesData.Area;
            this.BackgroundColor = Color.FromHex(SetColor.GetHexColor(notesData));
            this.collabarate     = notesData.IsCollaborated;
        }
Example #24
0
        private void DisplayWorld()
        {
            for (int y = 0; y < world.GetLength(1); y++)
            {
                for (int x = 0; x < world.GetLength(0); x++)
                {
                    Room room = world[x, y];
                    if (player.X == x && player.Y == y)
                    {
                        SetColor.SetTextColor(player.Symbol);
                        Console.Write(player.Symbol);
                        SetColor.SetTextColor('d');
                    }
                    else if (enemyPlayer.X == x && enemyPlayer.Y == y)
                    {
                        Console.Write(enemyPlayer.Symbol);
                    }
                    else if (room.WorldObject != null)
                    {
                        SetColor.SetTextColor(room.WorldObject.Symbol);
                        Console.Write(room.WorldObject.Symbol);
                        SetColor.SetTextColor('d');
                    }

                    else if (room.Monster != null)
                    {
                        SetColor.SetTextColor(room.Monster.Symbol);
                        Console.Write(room.Monster.Symbol);
                        SetColor.SetTextColor('d');
                    }
                    else if (room.Item != null)
                    {
                        SetColor.SetTextColor(room.Item.Symbol);
                        Console.Write(room.Item.Symbol);
                        SetColor.SetTextColor('d');
                    }
                    else
                    {
                        Console.Write(" ");
                    }
                }
                Console.WriteLine();
            }
        }
Example #25
0
        private void BuildTextDisplayBox()
        {
            string top    = " _________________________________";
            string bottom = "|_________________________________|";

            SetColor.SetTextColor('%');

            Console.SetCursorPosition(0, 16);
            Console.Write(top);
            for (int row = 17; row < 24; row++)
            {
                Console.SetCursorPosition(0, row);
                Console.Write("|");
                Console.SetCursorPosition(34, row);
                Console.Write("|");
            }
            Console.SetCursorPosition(0, 24);
            Console.Write(bottom);
            SetColor.SetTextColor('d');
        }
Example #26
0
        public ModifyImage(int actualSelection, Selections selectionData, bool customColor)
        {
            this.beginX             = selectionData.beginX;
            this.endX               = selectionData.endX;
            this.beginY             = selectionData.beginY;
            this.endY               = selectionData.endY;
            this.temporaryFilesPath = selectionData.temporaryFilesPath;
            this.actualSelection    = actualSelection;

            if (customColor == true)
            {
                setColor = SetColor.custom;
            }
            else
            {
                setColor = SetColor.fromImage;
            }

            loadedBitmap         = new LoadBitmap(actualSelection, temporaryFilesPath);
            this.bitmapFromInput = loadedBitmap.BitmapFromStream;
        }
Example #27
0
    // Change the grid color for dark / light mode
    public static void SetGrid()
    {
        GameObject[] grid = GameObject.FindGameObjectsWithTag("background_block");


        for (int i = 0; i < grid.Length; i++)
        {
            MeshRenderer bgBlock  = grid[i].GetComponent <MeshRenderer>();
            Material[]   meshMats = bgBlock.materials;

            if (SetColor.GetDarkMode() == true)
            {
                meshMats[1] = null;
                meshMats[1] = SetColor.GetMaterial("Grid");
            }
            else
            {
                meshMats[1] = null;
                meshMats[1] = SetColor.GetMaterial("Grid");
            }

            bgBlock.materials = meshMats;
        }
    }
Example #28
0
 // Start is called before the first frame update
 void Start()
 {
     setcolor   = gameObject.GetComponentInParent <SetColor>();
     scoreboard = GameObject.FindWithTag("Scoreboard").GetComponent <Scoreboard>();
     health     = setcolor.health;
 }
Example #29
0
        // Start is called before the first frame update

        public static void Log(string Text, SetColor myColor)
        {
            Text = string.Format("<color={0}>{1}</color>", myColor.ToString(), Text);
            Debug.Log(Text);
        }
Example #30
0
 protected void SetColor32(SetColor color)
 {
     drawRect = new Rectangle((int)color % 4 * 32, (int)color / 4 * 32, 32, 32);
 }
Example #31
0
        public VirtualEnemyBullet(Vector2 parentPos, Vector2 startDirect, int indexNum, float spd, SetColor color)
        {
            position       = parentPos;
            startDirection = startDirect;
            index          = indexNum;
            baseSpeed      = spd;

            time = 0;

            isDead = false;
        }
Example #32
0
 // Constructor
 public Player(string name, SetColor setColor)
 {
     Name = name;
     Color = setColor;
 }