如何使线条上方具有不同的颜色?

时间:2018-08-15 13:48:53

标签: vb.net

嗨,我在做老虎机,每当您得到某种水果(苹果,樱桃或香蕉)时,它的颜色都会变为该水果的颜色。我有为其选择随机水果的代码,它会更改颜色,但是当它更改颜色时,它只会更改下面各行的颜色,而不会更改其实际含义。因此,有谁知道如何使您上方的线变色。

log4j.appender.fileLogger.filePattern=%i.log.zip 

1 个答案:

答案 0 :(得分:1)

假设Console.WriteLine(slot1(RandomNumber));是需要不同颜色的部分,这就是答案。

// Method for performing a lever pull on the slot machine
Public Sub PullLever() {
    // Slot Fruits
    slot1 = {"Apple", "Cherry", "Banana"}
    slot2 = {"Apple", "Cherry", "Banana"}
    slot3 = {"Apple", "Cherry", "Banana"}


    // Randomize fruit
    RandomNumber = rand.Next(0, slot1.Length)
    // Get the fruit name
    slotmachine1 = slot1(RandomNumber)

    // Choose Color
    If slotmachine1 = "Apple" Then
        Console.ForegroundColor = ConsoleColor.Green
    ElseIf slotmachine1 = "Cherry" Then
        Console.ForegroundColor = ConsoleColor.Red
    ElseIf slotmachine1 = "Banana" Then
        Console.ForegroundColor = ConsoleColor.Yellow
    End If

    // Write to console the chosen fruit
    Console.WriteLine(slotmachine1);
}