--获取蔚蓝命名空间(c#)
local celeste= require("#Celeste")

--获取蔚蓝GFX 静态类c#）
local gfx = require("#Celeste.GFX")

function onTalk()

    
    disableMovement()
    disableRetry()
    wait(0.75)
    walkTo(1805)

    --调镜头
    say("ChineseNewYear2024_0_lobby_prologue_grannytea_first")

    --奶奶动画切换
    setFlag("decal_flag_cny_po_grannyA",true)

    --对话1
    say("ChineseNewYear2024_0_lobby_prologue_grannytea")

    --感谢sap和zzm喵(•ω•`)o

    --隐藏玩家的头发和本体
    player.Sprite.Visible = false
    player.Hair.Visible = false

    --从精灵库中创建一个叫"CollabUtils2_sitBench”的动画
    local spr = gfx.SpriteBank:Create("CollabUtils2_sitBench")

    --将动画附加到玩家身上
    player:Add(spr)

    --播放该动画的"sit"动画
    spr:Play("sit",false,false)

    --同理
    local hairSpr= gfx.SpriteBank:Create("CollabUtils2_sitBench")
    player:Add(hairSpr)

    --复制头发颜色到我们的头发上
    hairSpr.Color = player.Hair.Color;
    hairSpr:Play("sitHair",false,false)
        
    --喝茶
    if  getFlag("decal_flag_cny_po_grannyA") then
        setFlag("flag_black_granny_tea",true)
    end
    wait(3)
    setFlag("flag_black_granny_tea",false)

    --对话2
    say("ChineseNewYear2024_0_lobby_prologue_grannytea_B")

    --选择对话部分
    a=0
    repeat
        local thischoice = choice("ChineseNewYear2024_0_lobby_prologue_grannytea_B_MAD_A","ChineseNewYear2024_0_lobby_prologue_grannytea_B_MAD_B","ChineseNewYear2024_0_lobby_prologue_grannytea_B_MAD_C","ChineseNewYear2024_0_lobby_prologue_grannytea_B_MAD_D")
        if  thischoice == 1 then            
            say("ChineseNewYear2024_0_lobby_prologue_grannytea_B_MAD_A_01")
        elseif thischoice == 2 then 
            say ("ChineseNewYear2024_0_lobby_prologue_grannytea_B_MAD_B_01")
        elseif thischoice == 3 then 
            say("ChineseNewYear2024_0_lobby_prologue_grannytea_B_MAD_C_01")
        elseif thischoice == 4 then 
            say("ChineseNewYear2024_0_lobby_prologue_grannytea_B_MAD_D_01")
            a = 514
        else
            say("ChineseNewYear2024_0_lobby_prologue_grannytea_B")
        end
    until( a > 114 )

    wait(0.5)
    setFlag("cny2024_po_endend_hahaha",true)
    say("ChineseNewYear2024_0_lobby_prologue_grannytea_end")
        
    wait(4)
    completeArea(false,false,true)
    enableMovement()
    
end

function onEnd(level,wasSkipped)
    if wasSkipped then
        setFlag("decal_flag_cny_po_grannyA",false)
        setFlag("cny2024_po_endend_hahaha",false)
        completeArea(false,true,true)
    end
end