コード例 #1
0
ファイル: HeaderParser.cs プロジェクト: CrispyDrone/BWSort
        private IPlayer ParsePlayer(int index)
        {
            // identifier, slottype are wrong?? weird values
            int      identifier = _input.ReadInt();
            SlotType slotType   = (SlotType)_input.ReadInt();

            PlayerType playerType = (PlayerType)_input.ReadByte();
            RaceType   raceType   = (RaceType)_input.ReadByte();
            byte       forceId    = _input.ReadByte();

            // name is missing 4 characters with UTF8 encoding means 4 bytes...
            String name = parseString(PLAYER_NAME_SIZE);

            ColourType colourType = ColourType.Unknown;
            byte       spot       = 0;

            if (index < 8)
            {
                int colourOffset = PLAYER_COLOUR_OFFSET + (index * 4);
                colourType = (ColourType)_data[colourOffset];

                int spotOffset = PLAYER_SPOT_OFFSET + index;
                spot = _data[spotOffset];
            }


            return(new Player(identifier, slotType, playerType, raceType, forceId, name, colourType, spot));
        }
コード例 #2
0
    public Color ColourFromColourType(ColourType c)
    {
        switch (c)
        {
        case ColourType.White:
            return(Color.white);

            break;

        case ColourType.Green:
            return(Color.green);

            break;

        case ColourType.Pink:
            return(Color.magenta);

            break;

        case ColourType.Orange:
            return(new Color(1, 0.5f, 0.07f));

            break;
        }
        return(Color.black);
    }
コード例 #3
0
 private MinimapItem(SceneNode realObjectNode, SceneManager minimapMgr, String meshName, ColourValue colour,
                     ColourType colourType, Entity sizeEnity, Vector2 scaleOverride)
     : this(realObjectNode, minimapMgr, meshName, sizeEnity, scaleOverride)
 {
     this.colourType = colourType;
     this.Colour     = colour;
 }
コード例 #4
0
    public void SetGamePlayVariables(ColourType col)
    {
        var c = Character.instance;

        if (gameover || c.combo < 10)
        {
            SetMultiplierVariables(Multiplier.None, 0.0f, col);
            return;
        }
        else
        {
            if (c.combo >= 10 && c.combo < 25)
            {
                SetMultiplierVariables(Multiplier.x2, 1.0f, col);
            }
            else if (c.combo >= 25 && c.combo < 50)
            {
                SetMultiplierVariables(Multiplier.x3, 1.5f, col);
            }
            else if (c.combo >= 50 && c.combo < 100)
            {
                SetMultiplierVariables(Multiplier.x4, 2.0f, col);
            }
            else
            {
                SetMultiplierVariables(Multiplier.x5, 2.5f, col);
            }
        }
    }
コード例 #5
0
        private IPlayer ParsePlayer(int index)
        {
            int      identifier = _input.ReadInt();
            SlotType slotType   = (SlotType)_input.ReadInt();

            PlayerType playerType = (PlayerType)_input.ReadByte();
            RaceType   raceType   = (RaceType)_input.ReadByte();
            byte       forceId    = _input.ReadByte();

            String name = parseString(PLAYER_NAME_SIZE);

            ColourType colourType = ColourType.Unknown;
            byte       spot       = 0;

            if (index < 8)
            {
                int colourOffset = PLAYER_COLOUR_OFFSET + (index * 4);
                colourType = (ColourType)_data[colourOffset];

                int spotOffset = PLAYER_SPOT_OFFSET + index;
                spot = _data[spotOffset];
            }

            return(new Player(identifier, slotType, playerType, raceType, forceId, name, colourType, spot));
        }
コード例 #6
0
    void OnHit(ColourType bulletColour)
    {
        if (colourType == ColourType.White)
        {
            // any bullet is good enough
            Die();
        }

        if (bulletColour == colourType)
        {
            // bullet matches my colour
            Die();
        }
        else if (colourType == ColourType.Orange)
        {
            // I'm orange
            // swap to the opposite colour
            if (bulletColour == ColourType.Green)
            {
                // change to pink
                colourType = ColourType.Pink;
            }
            else if (bulletColour == ColourType.Pink)
            {
                colourType = ColourType.Green;
            }
        }
        else
        {
            // I'm not white
            // the bullet colour didn't match my colour
            // I'm also not orange
            // GETANGRY()
        }
    }
コード例 #7
0
        protected override void ResetGame()
        {
            horLines = new ColourType[w - 1, h];
            verLines = new ColourType[w, h - 1];

            boxes = new ColourType[w - 1, h - 1];
        }
コード例 #8
0
        /// <summary>
        /// Add an alert.
        /// </summary>
        /// <param name="title">The title.</param>
        /// <param name="content">The content.</param>
        /// <param name="icon">The icon.</param>
        /// <param name="colourType">The background colour of the icon.</param>
        protected void AddAlert(string title, ContentViewModel content, string icon, ColourType colourType)
        {
            var alerts = ViewData.Get <List <ContentViewModel> >("Alerts") ?? new List <ContentViewModel>();

            alerts.Add(new ContentViewModel().AddIcon(icon, colourType).AddTitle(title).Merge(content));

            ViewData.Set <List <ContentViewModel> >("Alerts", alerts);
        }
コード例 #9
0
ファイル: Bullet.cs プロジェクト: TyLanger/Control
    public void BulletSetup(ColourType colour, Vector2 direction, float speed)
    {
        transform.up = direction;
        myColour     = colour;

        GetComponent <SpriteRenderer>().color = GameplayController.Instance.ColourFromColourType(myColour);
        moveSpeed = speed;
    }
コード例 #10
0
        void CreateLine(ColourType type, int x1, int x2, int y1, int y2)
        {
            int x = Math.Min(x1, x2);
            int y = Math.Min(y1, y2);

            bool filled = false;

            if (y1 == y2)
            {
                horLines[x, y] = type;

                if (y != 0)
                {
                    CheckFillBox(type, x, y - 1, ref filled);
                }
                if (y <= boxes.GetUpperBound(1))
                {
                    CheckFillBox(type, x, y, ref filled);
                }
            }
            else
            {
                verLines[x, y] = type;

                if (x != 0)
                {
                    CheckFillBox(type, x - 1, y, ref filled);
                }
                if (x <= boxes.GetUpperBound(0))
                {
                    CheckFillBox(type, x, y, ref filled);
                }
            }

            if (!filled)
            {
                SwapTurn();
            }

            if (AllBoxesFull(out int red, out int blue))
            {
                if (red == blue)
                {
                    GameEnd($"It's a tie! (Red: {red} Blue: {blue})");
                }
                else
                {
                    if ((playerWhite && red > blue) || (!playerWhite && blue > red))
                    {
                        GameEnd($"You win! (Red: {red} Blue: {blue})");
                    }
                    else
                    {
                        GameEnd($"You lose! (Red: {red} Blue: {blue})");
                    }
                }
            }
        }
コード例 #11
0
ファイル: ColourPiece.cs プロジェクト: creatayeats/CTP
    public void SetColour(ColourType newColour)
    {
        colour = newColour;

        if (colourSpriteDict.ContainsKey(newColour))
        {
            sprite.sprite = colourSpriteDict [newColour];
        }
    }
コード例 #12
0
ファイル: 6.8.cs プロジェクト: NikitaVas/CSharp
 public Car(short placeNumber, string number = "AA0000", ColourType colour = ColourType.Black,
     string owner = "No owner", bool isOnThePlace = true)
 {
     PlaceNumber = placeNumber;
     Number = number;
     Colour = colour;
     Owner = owner;
     IsOnThePlace = isOnThePlace;
 }
コード例 #13
0
    public void Init()
    {
        var colourIndex = UnityEngine.Random.Range(0, backgroundColours.Length);

        currentColour = HelperFunctions.SetColourType(colourIndex);
        Camera.main.DOColor(backgroundColours [colourIndex], 1.0f);
        inGame  = true;
        strikes = 0;
        MainMenu.instance.gameObject.SetActive(false);
    }
コード例 #14
0
ファイル: Weapon.cs プロジェクト: TyLanger/Control
    public void Fire(ColourType colour, Vector2 direction)
    {
        if (Time.time > timeOfNextShot)
        {
            timeOfNextShot = Time.time + timeBetweenShots;
            // spawn a bullet
            Bullet bulletCopy = Instantiate(bullet, bulletSpawn.position, Quaternion.identity);

            bulletCopy.BulletSetup(colour, direction, bulletSpeed);
        }
    }
コード例 #15
0
 void CheckFillBox(ColourType type, int x, int y, ref bool filled)
 {
     if ((horLines[x, y] != ColourType.NONE) &&
         (horLines[x, y + 1] != ColourType.NONE) &&
         (verLines[x, y] != ColourType.NONE) &&
         (verLines[x + 1, y] != ColourType.NONE))
     {
         boxes[x, y] = type;
         filled      = true;
     }
 }
コード例 #16
0
 public ColourData(string colourValue, string tintValue, ColourType newColourType)
 {
     m_colourValue = colourValue;
     m_type = newColourType;
     m_tintValue = tintValue;
     m_hasTint = false;
     if (!String.IsNullOrEmpty(tintValue))
     {
         m_hasTint = true;
     }
 }
コード例 #17
0
    public Color GetRandomColor(ColourType otherColour)
    {
        currentColourType = (ColourType)UnityEngine.Random.Range(0, 6);
        shadeIndex        = UnityEngine.Random.Range(0, 6);
        var newColour = colors[(int)currentColourType];

        while (newColour.type == otherColour)
        {
            currentColourType = (ColourType)UnityEngine.Random.Range(0, 6);
            newColour         = colors[(int)currentColourType];
        }
        return(newColour.color[shadeIndex]);
    }
コード例 #18
0
 internal static FakeVehicle CreateAFakeVehicle(int id      = 0,
                                                string name = "Name1",
                                                string registrationNumber = "RegistrationNumber1",
                                                ColourType colour         = ColourType.Grey)
 {
     return(new FakeVehicle
     {
         Id = id,
         Name = name,
         RegistrationNumber = registrationNumber,
         Colour = colour
     });
 }
コード例 #19
0
 public Player(int identifier, SlotType slotType, PlayerType playerType,
               RaceType raceType, byte forceId, String name,
               ColourType colourType, byte spot)
 {
     this.Identifier      = identifier;
     this.SlotType        = slotType;
     this.PlayerType      = playerType;
     this.RaceType        = raceType;
     this.ForceIdentifier = forceId;
     this.Name            = name;
     this.ColourType      = colourType;
     this.Spot            = spot;
 }
コード例 #20
0
        static Color GetColour(ColourType type)
        {
            switch (type)
            {
            default:
                return(Color.Transparent);

            case ColourType.RED:
                return(Color.Red);

            case ColourType.BLUE:
                return(Color.Blue);
            }
        }
コード例 #21
0
    public void NextColour()
    {
        int a = (int)currentColourType;
        //shift to the next color in the enum
        int b = (int)++currentColourType;

        //if we are at the end of the enum reset the values
        if (b >= colors.Length)
        {
            b = 0;
        }

        currentColourType = (ColourType)b;
    }
コード例 #22
0
 public override void OnReloadPressed(PlayerController player, Gun gun, bool manualReload)
 {
     if (CurrentColourFiringMode == ColourType.RED)
     {
         CurrentColourFiringMode = ColourType.YELLOW;
         VFXToolbox.DoStringSquirt("YELLOW", gun.sprite.WorldCenter, ExtendedColours.honeyYellow);
     }
     else if (CurrentColourFiringMode == ColourType.YELLOW)
     {
         CurrentColourFiringMode = ColourType.BLUE;
         VFXToolbox.DoStringSquirt("BLUE", gun.sprite.WorldCenter, Color.blue);
     }
     else if (CurrentColourFiringMode == ColourType.BLUE)
     {
         CurrentColourFiringMode = ColourType.RED;
         VFXToolbox.DoStringSquirt("RED", gun.sprite.WorldCenter, Color.red);
     }
     base.OnReloadPressed(player, gun, manualReload);
 }
コード例 #23
0
ファイル: MenuColours.cs プロジェクト: jonny2027/MinigolfVR
    public static Color GetColour(ColourType colour)
    {
        switch (colour)
        {
        case ColourType.DarkGreen:
            return(new Color(0.25f, 0.4f, 0.17f, 0.9019f));

        case ColourType.LightGreen:
            return(new Color(0.5f, 0.804f, 0.345f, 0.9019f));

        case ColourType.Tan:
            break;

        default:
            break;
        }

        return(new Color(0.5f, 0.804f, 0.345f, 0.9019f));
    }
コード例 #24
0
    public void SetMultiplierVariables(Multiplier m, float mSize, ColourType col)
    {
        if (HelperFunctions.CompareColour(Character.instance.colour, col))
        {
            mSize += 0.75f;
            switch (m)
            {
            case Multiplier.None:
                m = Multiplier.x2;
//				Debug.Log("x2");
                break;

            case Multiplier.x2:
                m = Multiplier.x4;
//				Debug.Log("x4");
                break;

            case Multiplier.x3:
                m = Multiplier.x6;
//				Debug.Log("x6");
                break;

            case Multiplier.x4:
                m = Multiplier.x8;
//				Debug.Log("x8");
                break;

            case Multiplier.x5:
                m = Multiplier.x10;
//				Debug.Log("x10");
                break;
            }
        }
//		else
//			Debug.Log(m.ToString());
        //set the current multiplier
        currentMultiplier = m;
        //update the UI Multiplier
        UserInterface.instance.UpdateMultiplier(currentMultiplier, mSize);
        //set consumable values
        SequenceManager.instance.GetCurrentSequence().SetConsumableValues(m);
    }
コード例 #25
0
        public EditorColorChanger(Color _color, ColourType _colourType = ColourType.Background)
        {
            colourType = _colourType;
            switch (colourType)
            {
            case ColourType.Background:
                color = GUI.backgroundColor;
                GUI.backgroundColor = _color;
                break;

            case ColourType.Content:
                color            = GUI.contentColor;
                GUI.contentColor = _color;
                break;

            case ColourType.Other:
                color     = GUI.color;
                GUI.color = _color;
                break;
            }
        }
コード例 #26
0
    /// <summary>
    /// returns a colour TextMeshPro Tag, eg. '<color = #FFE4B5', default White if colour isn't present
    /// </summary>
    /// <param name="colour"></param>
    /// <returns></returns>
    public string GetColour(ColourType colour)
    {
        //default white colour
        string colourTag = "#FFFFFF";

        //automatically handle an access call to an arrayIndex that hasn't been populated
        try
        {
            colourTag = GameManager.i.colourScript.arrayOfColours[(int)colour, (int)GameManager.i.optionScript.ColourOption].hexCode;
        }
        catch (IndexOutOfRangeException)
        {
            //return default white colour if no entry present
            Debug.LogError(string.Format("No colour present for {0} with ColourScheme {1}. Return default WHITE", colour, GameManager.i.optionScript.ColourOption));
        }
        catch (NullReferenceException)
        {
            //return default white colour if no entry present
            Debug.LogError(string.Format("No colour present for {0} with ColourScheme {1} (Null). Return default WHITE", colour, GameManager.i.optionScript.ColourOption));
        }
        return(string.Format("{0}{1}{2}", "<color=", colourTag, ">"));
    }
コード例 #27
0
    // Update is called once per frame
    void Update()
    {
        if (inGame && !UserInterface.instance.intermission)
        {
            int rand = UnityEngine.Random.Range(0, 1000);

            if (rand == 1)
            {
                var colourIndex = UnityEngine.Random.Range(0, backgroundColours.Length);
                Camera.main.DOColor(backgroundColours [colourIndex], 2.0f);

                currentColour = HelperFunctions.SetColourType(colourIndex);
            }
        }
        if (startTimer)
        {
            //check for new wave every 0.5 seconds
            delay -= Time.deltaTime;
            if (delay < 0.0f)
            {
                CheckForNewWave();
            }
        }
    }
コード例 #28
0
            public void AddColour(ChromaGun.ColourType colour)
            {
                if (colour == ColourType)
                {
                    return;
                }
                if (colour == ColourType.NONE)
                {
                    return;
                }
                if (ColourType == ColourType.BLACK)
                {
                    return;
                }

                //Colour Mixing
                ColourType finalColour = ColourType.NONE;

                if (ColourType != ColourType.NONE)
                {
                    if (colour == ColourType.RED)
                    {
                        if (ColourType == ColourType.YELLOW)
                        {
                            finalColour = ColourType.ORANGE;
                        }
                        else if (ColourType == ColourType.BLUE)
                        {
                            finalColour = ColourType.PURPLE;
                        }
                        else
                        {
                            finalColour = ColourType.BLACK;
                        }
                    }
                    else if (colour == ColourType.YELLOW)
                    {
                        if (ColourType == ColourType.RED)
                        {
                            finalColour = ColourType.ORANGE;
                        }
                        else if (ColourType == ColourType.BLUE)
                        {
                            finalColour = ColourType.GREEN;
                        }
                        else
                        {
                            finalColour = ColourType.BLACK;
                        }
                    }
                    else if (colour == ColourType.BLUE)
                    {
                        if (ColourType == ColourType.YELLOW)
                        {
                            finalColour = ColourType.GREEN;
                        }
                        else if (ColourType == ColourType.RED)
                        {
                            finalColour = ColourType.PURPLE;
                        }
                        else
                        {
                            finalColour = ColourType.BLACK;
                        }
                    }
                }
                else
                {
                    finalColour = colour;
                }

                //Actually set the enemy colour to the specified colour
                if (ColourType != ColourType.NONE)
                {
                    self.DeregisterOverrideColor("ChromaGunTint");
                }
                self.gameActor.RegisterOverrideColor(actualColours[finalColour], "ChromaGunTint");
                ColourType = finalColour;
            }
コード例 #29
0
        private void btnOrder_Click(object sender, RoutedEventArgs e)
        {
            string     brand          = tbCarBrand.Text;
            string     numberOfSeats  = tbNumberOfSeats.Text;
            string     numberOfWheels = tbNumberOfWheels.Text;
            ColourType color          = ColourType.Black;
            CarType    type           = CarType.Personal;



            // Variable til Antal sæder og hjul, som tal
            int numberOfSeatsInt  = 0;
            int numberOfWheelsInt = 0;

            // Check at det indtastede er korrekt
            var errorMessages = "";

            if (brand == "")
            {
                errorMessages += "Mærke skal udfyldes!\n";
            }

            if (thisIsANumber(numberOfSeats))
            {
                numberOfSeatsInt = getNumber(numberOfSeats);
            }
            else
            {
                errorMessages += "Antal sæder skal være et tal\n";
            }

            if (thisIsANumber(numberOfWheels))
            {
                numberOfWheelsInt = getNumber(numberOfWheels);
            }
            else
            {
                errorMessages += "Antal hjul skal være et tal\n";
            }

            if (cbColor.SelectedIndex >= 0)
            {
                if (Enum.TryParse(cbColor.Text, out color))
                {
                }
                else
                {
                    throw new Exception("Fejl i XAML");
                }
            }

            else
            {
                errorMessages += "Farve skal vælges";
            }

            if (cbType.SelectedIndex >= 0)
            {
                type = (CarType)cbType.SelectedItem;
            }
            else
            {
                errorMessages += "Type skal vælges";
            }

            // Alt er kontrolleret - er der sket nogle fejl?
            if (errorMessages == "")
            {
                // Ingen fejl - før ordren til de tidligere bestillinger
                // var ordre = string.Format("{0} {1} {2}, med {3} sæder og {4} hjul.", color, brand, type, numberOfSeatsInt, numberOfWheelsInt);
                // C#6 kan skrive det på en lidt mere overskuelig måde:
                var ordreCs6 = $"{color} {brand} {type}, med {numberOfSeatsInt} sæder og {numberOfWheelsInt} hjul.";

                var numberOfSimilarOrders = 0;
                foreach (var item in lstOrders.Items)
                {
                    if (ordreCs6 == (string)item)
                    {
                        numberOfSimilarOrders++;
                    }
                }

                orderLst.Add(ordreCs6);
                lstOrders.Items.Add(ordreCs6);
                MessageBox.Show($"Der er {numberOfSimilarOrders} ens ordre ud af {orderLst.Count}", "Succes");
            }
            else
            {
                // En eller flere havde fejl
                MessageBox.Show(errorMessages, "Der er fejl i det indtastede", MessageBoxButton.OK, MessageBoxImage.Exclamation);
            }
        }
コード例 #30
0
 public void Repaint(int red, int green, int blue, ColourType colourType)
 {
     // TODO: Add some validation logic and business logic.
 }
コード例 #31
0
 public void SetColour(ColourType c)
 {
     colourType = c;
 }
コード例 #32
0
ファイル: FillData.cs プロジェクト: killbug2004/WSProf
 public void ResetBackgroundColour(ColourType newType, string newValue)
 {
     m_bgColour.m_type = newType;
     m_bgColour.m_colourValue = newValue;
 }
コード例 #33
0
 private static ColourData GetColourData(string colourValue, string tintValue, ColourType newColourType)
 {
     return new ColourData(colourValue, tintValue, newColourType);
 }
コード例 #34
0
 public IActionResult ModelBindingTest(ColourType colour = ColourType.Unknown)
 {
     return(Ok(colour));
 }
コード例 #35
0
ファイル: FontData.cs プロジェクト: killbug2004/WSProf
 public void ResetColourData(ColourType newType, string newValue)
 {
     m_colour.m_type = newType;
     m_colour.m_colourValue = newValue;
 }