Inheritance: MonoBehaviour
Exemple #1
0
        public void Execute()
        {
            var color = RandomColor.GetRandomColor();

            hero.Fill       = color;
            hero.Shape.Fill = color;
        }
 /// <summary>
 /// 释放资源
 /// </summary>
 /// <param name="disposing">释放托管资源为true,否则为false</param>
 protected override void Dispose(bool disposing)
 {
     if (this.m_Origins != null)
     {
         foreach (AnimationFrame frame in this.m_Origins)
         {
             frame.Dispose();
         }
         this.m_Origins.Clear();
         this.m_Origins = null;
     }
     if (this.m_Frames != null)
     {
         this.m_Frames.Clear();
         this.m_Frames = null;
     }
     if (this.m_SuspendedOps != null)
     {
         this.m_SuspendedOps.Dispose();
         this.m_SuspendedOps = null;
     }
     if (this.m_Current != null)
     {
         this.m_Current.Dispose();
         this.m_Current = null;
     }
     this.m_RandomColor = null;
     this.m_Random      = null;
     this.m_From        = null;
 }
Exemple #3
0
    void OnClickFigure()
    {
        var clickStream = Observable.EveryUpdate()
                          .Where(_ => Input.GetMouseButtonDown(0));

        clickStream.Buffer(clickStream.Throttle(TimeSpan.FromMilliseconds(250)))
        .Subscribe(xs => {
            RaycastHit hit;
            Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);

            if (Physics.Raycast(ray, out hit))
            {
                Transform objectHit = hit.transform;
                string _tag         = objectHit.gameObject.tag;

                //Debug.Log(tag);
                if (_tag.CompareTo("Player") == 0)
                {
                    RandomColor randomColor = objectHit.gameObject.GetComponent <RandomColor>();
                    int _index = randomColor.myIndex;
                    ClickColorData itemData = geometryObjectData.clicksData[_index];
                    randomColor.AddCLick(itemData);
                }
            }
        }
                   );
    }
Exemple #4
0
        private void button3_Click(object sender, EventArgs e)
        {
            Color c1 = RandomColor.Generate();
            Color c2 = RandomColor.Generate();
            Color c3 = Color.White;
            Color c4 = Color.Black;

            Color[] arr1 = DradientColor.Generate(c1, c4, 12);
            Color[] arr2 = DradientColor.Generate(c3, c2, 12);
            for (int i = 0; i < 12; ++i)
            {
                Color[] arr = DradientColor.Generate(arr1[i], arr2[i], 7);
                for (int j = 0; j < 7; ++j)
                {
                    Bitmap   b = new Bitmap(64, 64);
                    Graphics g = Graphics.FromImage(b);
                    g.FillRectangle(
                        new SolidBrush(arr[j]),
                        0,
                        0,
                        64,
                        64);
                    pbs[i * 7 + j].Image = b;
                }
            }
        }
Exemple #5
0
 public CreateClassState()
 {
     EditPage.Instance.ToolPanel.DisplayCreateClassButtonAsSelected();
     _randomColor = new RandomColor();
     // EditPage.Instance.CloseDrawingBoardBegin();
     EditPage.Instance.DrawEmptyClassView();
 }
Exemple #6
0
 public Triangle(string name, double side, double tBase)
 {
     this.name   = name;
     Side        = side;
     Base        = tBase;
     FigureColor = RandomColor.randomColor();
 }
Exemple #7
0
        public async Task <List <TileViewModel> > GetTilesAsync()
        {
            await Task.Yield();

            if (!File.Exists(AttendeesFileName))
            {
                return(new List <TileViewModel>());
            }

            var tiles = File.ReadAllLines(AttendeesFileName)
                        .Where(x => !string.IsNullOrWhiteSpace(x))
                        .OrderBy(x => x)
                        .Select(x => x.Split('\t'))
                        .Select(x => new TileViewModel(
                                    name: x[0],
                                    attendeeId: x[1],
                                    remoteImageUri: null,
                                    // Randomize colour value
                                    color: new SolidColorBrush(RandomColor.GetColor(ColorScheme.Random, Luminosity.Bright))
                                    )).ToList();

            foreach (var tile in tiles)
            {
                tile.LoadImage(ImageFolder);
            }

            return(tiles);
        }
Exemple #8
0
 private void button3_Click(object sender, EventArgs e)
 {
     algo.FlightTime.Add("CA0001", DateTime.Now.AddDays(10));
     algo.FlightBaggageCount.Add("CA0001", 6400);
     algo.CurrCount.Add("CA0001", 0);
     for (int i = 0; i < 8; i++)
     {
         for (int j = 0; j < 7; j++)
         {
             for (int k = 0; k < 9; k++)
             {
                 Baggage b = new Baggage("CA0001", 21, RandomColor.GetRadomColor());
                 shelf1.PutBaggage(b, i, j);
                 algo.Push("CA0001", 0);
             }
         }
     }
     for (int i = 0; i < 7; i++)
     {
         for (int j = 0; j < 9; j++)
         {
             Baggage b = new Baggage("CA0001", 21, RandomColor.GetRadomColor());
             shelf1.PutBaggage(b, i, 7);
             algo.Push("CA0001", 0);
         }
     }
 }
        public Quadrate(string name)
        {
            this.name   = name;
            FigureColor = RandomColor.randomColor();
            Random r = new Random();

            Side = r.Next(100);
        }
Exemple #10
0
        public Circle(string name)
        {
            this.name   = name;
            FigureColor = RandomColor.randomColor();
            Random r = new Random();

            Radius = r.Next(100);
        }
        public ClassTableob(string html, DateTime begin, string studentnum = "10150111")
        {
            RandomColor rc = new RandomColor(studentnum);

            ClassTable = new List <List <Classob> >();
            TermBegin  = begin;
            if (ClassTable.Count == 0)
            {
                for (int i = 0; i < 8; i++)
                {
                    List <Classob> list = new List <Classob>();
                    ClassTable.Add(list);
                }
            }
            Regex regex = new Regex("<table[^>]*>.*</Table>");
            Match m     = regex.Match(html);

            regex = new Regex("<tr[^>]*>.*?</tr[^>]*>");
            MatchCollection mc        = regex.Matches(m.Value);
            string          teacher   = "";
            string          classname = "";
            string          date      = "";
            string          room      = "";
            Color           thiscolor = rc.Next();

            for (int trnum = 1; trnum < mc.Count; trnum++)
            {
                m = mc[trnum];
                string now = m.Value;
                if (Regex.IsMatch(now, "tr height=24"))
                {
                    thiscolor = rc.Next();
                    regex     = new Regex("<td[^>]*rowspan=(?<howmanytimes>\\d+)[^>]*>(?<class>[^<]*)</td><td[^>]*>\\d+</td><td[^>]*>(?<teacher>[^<]*)</td><td[^>]*>(?<date>[^<]*)</td><td [^>]*>(?<room>[^<]*)</td><td[^>]*>[^<]*</td><td[^>]*>[^<]*</td><td[^>]*>[^<]*</td></tr>");
                    m         = regex.Match(now);
                    GroupCollection gc = m.Groups;
                    teacher   = gc["teach"].Value;
                    classname = gc["class"].Value;
                    date      = gc["date"].Value;
                    room      = gc["room"].Value;
                    Classob nowclass = new Classob(teacher, classname, date, room, thiscolor);
                    ClassTable[nowclass.weekcode].Add(nowclass);
                }
                else
                {
                    regex = new Regex("<td[^>]*>(?<date>[^<]*)(<td[^>]*>(?<room>[^<]*))?");
                    m     = regex.Match(now);
                    GroupCollection gc = m.Groups;
                    date = gc["date"].Value;
                    if (!string.IsNullOrEmpty(gc["room"].Value))
                    {
                        room = gc["room"].Value;
                    }
                    Classob nowclass = new Classob(teacher, classname, date, room, thiscolor);
                    ClassTable[nowclass.weekcode].Add(nowclass);
                }
            }
            sort();
        }
Exemple #12
0
        public Triangle(string name)
        {
            this.name   = name;
            FigureColor = RandomColor.randomColor();
            Random r = new Random();

            Side = r.Next(100);
            Base = r.Next(100);
        }
Exemple #13
0
        private void AssignRandomColors()
        {
            var colors = RandomColor.GetColors(ColorScheme.Random, fillCB.Checked ? Luminosity.Light : Luminosity.Dark,
                                               _voronoi.Sites.Count);

            for (int i = 0; i < _voronoi.Sites.Count; ++i)
            {
                _voronoi.Sites[i].Color = colors[i];
            }
        }
Exemple #14
0
        public static System.Drawing.Color[] RandomComplementaryColor()
        {
            var arr = new System.Drawing.Color[2];

            arr[0] = RandomColor.Generate();
            arr[1] = System.Drawing.Color.FromArgb(
                (byte)~arr[0].R,
                (byte)~arr[0].G,
                (byte)~arr[0].B);
            return(arr);
        }
Exemple #15
0
        private void GenerateButton_Click(object sender, EventArgs e)
        {
            var arr = DradientColor.Generate(RandomColor.Generate(), RandomColor.Generate(), 9);

            CozyColorListView.Clear();

            foreach (var c in arr)
            {
                CozyColorListView.AddColor(c);
            }
        }
        private void GenerateColors()
        {
            var colors = RandomColor.GetColors(Scheme, Luminosity, NumberToGenerate);

            GeneratedColorsListBox.BeginInit();
            GeneratedColorsListBox.Items.Clear();
            foreach (var c in colors)
            {
                GeneratedColorsListBox.Items.Add(new SolidColorBrush(c));
            }
            GeneratedColorsListBox.EndInit();
        }
        public override async void OnKeyPress(IntPtr wParam, IntPtr lParam)
        {
            base.OnKeyPress(wParam, lParam);

            var color = new RandomColor();

            var keys = _manhattanDistance.GetManhattanDistances(PressedKey, KeyMap.Keys);

            foreach (var key in keys)
            {
                await Task.Delay(1);

                React(key, color);
            }
        }
Exemple #18
0
    public Head(int bodyCount) : base("Head", Color.white, 1, Vector3.up * 1.5f + Vector3.back * 45f, GameObject.Find("Snake"))
    {
        BodyList = new List <Body>();
        Color lastColor = Color.black;

        for (int i = 0; i < bodyCount; i++)
        {
            RandomColor randomColor = new RandomColor();
            if (i > 0)
            {
                randomColor.SetColorPercent(lastColor, -20f);
            }
            lastColor = randomColor.GetRandomColor();
            AddBody(new Body(lastColor, 1, Transform.position - Transform.forward * 1.5f * (i + 1)));
        }
    }
Exemple #19
0
        private void AssignMinimumColors()
        {
            var colors = RandomColor.GetColors(ColorScheme.Random, fillCB.Checked ? Luminosity.Light : Luminosity.Dark,
                                               _voronoi.Sites.Count);

            _voronoi.Sites.ForEach(s => s.Color = Color.Green);
            DumpSites();
            foreach (var site in _voronoi.Sites)
            {
                var sitesWithCommonEdges    = _voronoi.HaveCommonEdges(site);
                var colorsUsedInCommonSites = sitesWithCommonEdges.Where(s => s.Color != Color.Green).Select(s => s.Color).Distinct();
                var nextColor = colors.First(c => !colorsUsedInCommonSites.Contains(c));

                site.Color = nextColor;
            }
        }
Exemple #20
0
        // The main entry point for glow smarts.
        public void Run()
        {
            // Create the LED controller
            m_ledController = new LedController();

            // Create all of the programs and add them to the cache.
            IProgram program = new GlowControl();

            program.InitProgram(this);
            m_programCache.Add(GlowPrograms.GlowControl, program);

            program = new DiscoveryControl();
            program.InitProgram(this);
            m_programCache.Add(GlowPrograms.DiscoveryControl, program);

            program = new ManualColor();
            program.InitProgram(this);
            m_programCache.Add(GlowPrograms.ManualColors, program);

            program = new Clock();
            program.InitProgram(this);
            m_programCache.Add(GlowPrograms.Clock, program);

            program = new Weather();
            program.InitProgram(this);
            m_programCache.Add(GlowPrograms.Weather, program);

            program = new WeatherCam();
            program.InitProgram(this);
            m_programCache.Add(GlowPrograms.WeatherCam, program);

            program = new RandomColor();
            program.InitProgram(this);
            m_programCache.Add(GlowPrograms.RandomColor, program);

            // Create a command listener
            m_commandServer = new CommandServer(this, CommandServer.CommmandServerMode.Server);

            // Setup the main worker thread.
            m_continueWorking = true;
            m_lastWorkTime    = DateTime.Now;
            m_workerThread    = new Task(WorkLoop);
            m_workerThread.Start();
        }
Exemple #21
0
        public override void OnCreated(IThreading threading)
        {
            Console.Message("loading auto color monitor");
            Console.Message("initializing colors");
            RandomColor.Initialize();

            Console.Message("loading current config");
            var config = Configuration.LoadConfig();

            _colorStrategy  = SetColorStrategy(config.ColorStrategy);
            _namingStrategy = SetNamingStrategy(config.NamingStrategy);
            _usedColors     = new List <Color32>();

            Console.Message("Found color strategy of " + config.ColorStrategy);
            Console.Message("Found naming strategy of " + config.NamingStrategy);

            _initialized = true;
            base.OnCreated(threading);
        }
Exemple #22
0
 private void randomColor()
 {
     for (int i = 0; i < 12; ++i)
     {
         for (int j = 0; j < 7; ++j)
         {
             Color    c = RandomColor.Generate();
             Bitmap   b = new Bitmap(64, 64);
             Graphics g = Graphics.FromImage(b);
             g.FillRectangle(
                 new SolidBrush(c),
                 0,
                 0,
                 64,
                 64);
             pbs[i * 7 + j].Image = b;
         }
     }
 }
Exemple #23
0
    void CreateFigures()
    {
        int    ind             = UnityEngine.Random.Range(0, items.name.Count);
        string AssetBundlePath = Application.streamingAssetsPath + "/AssetBundles/";

        AssetBundle.LoadFromFileAsync(AssetBundlePath + items.name[ind]).AsAsyncOperationObservable()
        .Subscribe(xs =>
        {
            GameObject[] allObjectsBundle1Prefabs = xs.assetBundle.LoadAllAssets <GameObject>();
            //  Debug.Log(ind);

            GameObject obj = Instantiate(allObjectsBundle1Prefabs[0]);
            xs.assetBundle.Unload(false);

            RandomColor randomColor = obj.GetComponent <RandomColor>();
            randomColor.StartUpdate(gameData.observableTime, geometryObjectData.clicksData[ind].color, ind);
            OnClickFigure();
        });
    }
Exemple #24
0
    // Update is called once per frame
    void Update()
    {
        if (!PauseMenuScript.PauseMenuEnabled)
        {
            if (ObjectSelectScript.selectedColor && ObjectSelectScript.Selected)
            {
                if (Input.GetButtonDown("Select"))
                {
                    RaycastHit hitInfo;
                    Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);

                    if (Physics.Raycast(ray, out hitInfo))
                    {
                        if (hitInfo.transform.tag == "Ground" || hitInfo.transform.tag == "Wall" || hitInfo.transform.tag == "Furniture" ||
                            hitInfo.transform.tag == "Fence")
                        {
                            if (hitInfo.transform.tag == "Furniture" || hitInfo.transform.tag == "Fence")
                            {
                                Renderers = hitInfo.transform.GetComponentsInChildren <MeshRenderer>();
                            }
                            else
                            {
                                Renderers = hitInfo.transform.parent.GetComponentsInChildren <MeshRenderer>();
                            }

                            if (hitInfo.transform.tag == "Wall" || hitInfo.transform.tag == "Ground")
                            {
                                RandomColorScript             = hitInfo.transform.parent.GetComponent <RandomColor>();
                                RandomColorScript.randomColor = ObjectSelectScript.selectedMaterial.color;
                            }

                            foreach (MeshRenderer renderer in Renderers)
                            {
                                renderer.material = ObjectSelectScript.selectedMaterial;
                            }
                        }
                    }
                }
            }
        }
    }
Exemple #25
0
 private void button2_Click(object sender, EventArgs e)
 {
     for (int i = 0; i < 12; ++i)
     {
         Color   f   = RandomColor.Generate();
         Color   t   = RandomColor.Generate();
         Color[] arr = DradientColor.Generate(f, t, 7);
         for (int j = 0; j < 7; ++j)
         {
             Bitmap   b = new Bitmap(64, 64);
             Graphics g = Graphics.FromImage(b);
             g.FillRectangle(
                 new SolidBrush(arr[j]),
                 0,
                 0,
                 64,
                 64);
             pbs[i * 7 + j].Image = b;
         }
     }
 }
    void CreatePuzzle()
    {
        while (trngls.Count != 0)
        {
            Color        color      = RandomColor.GetRandomColor();
            int          listCount  = trngls.Count;
            int          rand       = Random.Range(0, listCount);
            Vector2      size       = 2f * Vector2.one;
            Collider2D[] colls      = Physics2D.OverlapBoxAll(trngls[rand].transform.position, size, 0f, layer);
            GameObject   collection = new GameObject();

            collection.transform.position = trngls[rand].transform.position;
            collection.name = "Collection";
            foreach (Collider2D c in colls)
            {
                c.transform.SetParent(collection.transform);
                c.GetComponent <SpriteRenderer>().color = color;
                trngls.Remove(c.gameObject);
            }
            collections.Add(collection);
        }
    }
Exemple #27
0
        public static Attack StartAttack(int maxCells, int maxDamage, int maxHealth)
        {
            var random = new Random();

            var cellNumber  = random.Next(maxCells) + 1;
            var randomColor = new RandomColor(cellNumber);
            var damage      = maxDamage == 0 ? DefaultMaxDamage : maxDamage;
            var health      = maxHealth == 0 ? DefaultMaxDamage : maxDamage;

            var cells = new List <Cell>();

            for (int i = 0; i < cellNumber; i++)
            {
                cells.Add(new Cell(randomColor.GetRandom())
                {
                    Damage = random.Next(damage) + 1,
                    Health = random.Next(health) + 1
                });
            }

            return(new Attack(cells));
        }
Exemple #28
0
    void Update()
    {
        //-----------------------------------------------
        // Stop active co-routines when light is disabled
        //-----------------------------------------------
        if (!Enabled && !coRoutinesStopped)
        {
            StopAllCoroutines();
            coRoutinesStopped = true;
        }

        if (!visualize)
        {
            lightAction = GetLightAction();
            StartCoroutine(lightAction.ModulateLight(lightObj, speed, upperIntensityBounds, lowerIntensityBounds));
        }
        else if (visualize)
        {
            lightObj.intensity = ((audioVisualizer.audioBandBuffer[band] * scaleMagnitude) * (maxIntensity - minIntensity) + minIntensity);
        }

        if (rotate)
        {
            rotateType.Rotate(gameObject, xAngle, yAngle, zAngle, period, rotationSpeed);
        }

        if (colorRandomizer)
        {
            if (gameObject.GetComponent <RandomColor>() == null)
            {
                randomColor = gameObject.AddComponent <RandomColor>();
            }

            randomColor.Randomize(randomizeTime);
        }
    }
Exemple #29
0
 public Circle(string name, double radius)
 {
     this.name   = name;
     Radius      = radius;
     FigureColor = RandomColor.randomColor();
 }
Exemple #30
0
 public FColorful()
 {
     InitializeComponent();
     uiPanel11.FillColor = uiPanel11.RectColor = RandomColor.GetColor(ColorScheme.Random, Luminosity.Bright);
     uiLabel2.Text       = "RGB: " + uiPanel11.FillColor.R + ", " + uiPanel11.FillColor.G + ", " + uiPanel11.FillColor.B;
 }