local Screen = require "widgets/screen"
local Button = require "widgets/button"
local AnimButton = require "widgets/animbutton"
local ImageButton = require "widgets/imagebutton"
local Menu = require "widgets/menu"
local Text = require "widgets/text"
local Image = require "widgets/image"
local UIAnim = require "widgets/uianim"
local Widget = require "widgets/widget"
local PopupDialogScreen = require "screens/popupdialog"
local Grid = require "widgets/grid"
local Spinner = require "widgets/spinner"
require "util"
require "strings"
local TextEdit = require "widgets/textedit"
local textfont = UIFONT
local fontsize1 = 34
local fontsize2 = 30

for _, moddir in ipairs(KnownModIndex:GetModsToLoad()) do
if KnownModIndex:GetModInfo(moddir).name == "Chinese" then fontsize1 = 34 fontsize2 = 30 end
end

local YuyiScreen = Class(Screen, function(self)

    Screen._ctor(self, "YuyiScreen")
    self.active = true
    SetPause(true,"pause")

    --darken everything behind the dialog
    self.proot = self:AddChild(Widget("ROOT"))
    self.proot:SetVAnchor(ANCHOR_MIDDLE)
    self.proot:SetHAnchor(ANCHOR_MIDDLE)
    self.proot:SetPosition(0,0,0)
    self.proot:SetScaleMode(SCALEMODE_PROPORTIONAL)

    --throw up the background
    local shield = self.proot:AddChild( Image( "images/yuyi_shezhi.xml", "yuyi_shezhi.tex" ) )
    shield:SetPosition( 0,45,0 )
    shield:SetSize( 900, 750 )
    local label = self.proot:AddChild( Text( textfont, fontsize1, STRINGS.YUYISCREEN1 ))
	local labels = self.proot:AddChild( Text( textfont, fontsize1, string.format("Version[%s]",STRINGS.YUYISCREEN2) ))
    label:SetPosition( -170, 250, 0 )
    label:SetRegionSize( 200, 40 )
    label:SetHAlign( ANCHOR_MIDDLE )
    label:SetColour(20,240,150,1)
    labels:SetPosition( 120, 250, 0 )
    labels:SetRegionSize( 200, 40 )
    labels:SetHAlign( ANCHOR_MIDDLE )
    labels:SetColour(0,128,255,1)

    local player = GetPlayer()
	local yiyu_absorball = 0
	local yuyi_weapondmg = 0
	local absorb1 = 0--护甲头
	local absorb2 = 0--护甲胸
	local absorb3 = 0--护吸收
	local corselet = player.components.inventory:GetEquippedItem(EQUIPSLOTS.BODY)
	local weapon = player.components.inventory:GetEquippedItem(EQUIPSLOTS.HANDS)
	if weapon and weapon.components.weapon and weapon.components.weapon.damage then
		yuyi_weapondmg = weapon.components.weapon.damage
	end
	local helmet = player.components.inventory:GetEquippedItem(EQUIPSLOTS.HEAD)
	if corselet and corselet.components.armor and corselet.components.armor.absorb_percent then
		absorb1 = corselet.components.armor.absorb_percent
	end
	if helmet and helmet.components.armor and helmet.components.armor.absorb_percent then
		absorb2 = helmet.components.armor.absorb_percent
	end
	if player and player.components.health then
		absorb3 = player.components.health.absorb
	end
	local yiyu_absorball1 = 100-(100*absorb3)
	local yiyu_absorball2 = yiyu_absorball1-(yiyu_absorball1*absorb2)
	local yiyu_absorball3 = yiyu_absorball2-(yiyu_absorball2*absorb1)
	yiyu_absorball = 100-yiyu_absorball3

    self.grid1 = self.proot:AddChild(Grid())
    self.grid1:InitSize(1, 15, 700, -70)
    self.grid1:SetPosition(-170, 200, 0)
    self.grid1:SetScale(0.9, 0.6, 0.9)

    local spinners1 = {}
	local yiyulevels = GetPlayer().yiyulevel
    table.insert(spinners1, {STRINGS.YUYISCREEN3, string.format("%.0f/%.0f", player.skill_RLv,  4), "hh" ,false ,nil})
    table.insert(spinners1, {STRINGS.YUYISCREEN4, string.format("%.0f/%.0f", player.skill_JLv1, 5), "hh" ,false ,nil})
    table.insert(spinners1, {STRINGS.YUYISCREEN5, string.format("%.0f/%.0f", player.skill_KLv1, 5), "hh" ,false ,nil}) 
    table.insert(spinners1, {STRINGS.YUYISCREEN6, string.format("%.0f/%.0f", player.skill_LLv1, 5), "hh" ,false ,nil})
    table.insert(spinners1, {STRINGS.YUYISCREEN7, string.format("%.0f/%.0f", player.skill_ULv1, 5), "hh" ,false ,nil})
    table.insert(spinners1, {STRINGS.YUYISCREEN8, string.format("%.0f/%.0f", player.skill_ILv1, 5), "hh" ,false ,nil})
    table.insert(spinners1, {STRINGS.YUYISCREEN9, string.format("%.0f/%.0f", player.skill_OLv1, 5), "hh" ,false ,nil})
	table.insert(spinners1, {STRINGS.YUYISCREEN10, string.format("%.0f/%.0f", yiyu_absorball, 100) , "hh" ,false ,nil})
	table.insert(spinners1, {STRINGS.YUYISCREEN11, nil , "hh" ,false ,nil})
    for k,v in ipairs(spinners1) do self.grid1:AddItem(self:CreateSpinnerGroup(v[1], v[2], v[3], v[4]), 1, k) end

    self.grid2 = self.proot:AddChild(Grid())
    self.grid2:InitSize(1, 15, 700, -70)
    self.grid2:SetPosition(130, 200, 0)
    self.grid2:SetScale(0.9, 0.6, 0.9)
    local spinners2 = {}
    table.insert(spinners2, {STRINGS.YUYISCREEN12, string.format("%.0f/%.0f", player.skill_JLv0, 5), "hh" ,false ,nil})
    table.insert(spinners2, {STRINGS.YUYISCREEN13, string.format("%.0f/%.0f", player.skill_KLv0, 5), "hh" ,false ,nil}) 
    table.insert(spinners2, {STRINGS.YUYISCREEN14, string.format("%.0f/%.0f", player.skill_LLv0, 5), "hh" ,false ,nil})
    table.insert(spinners2, {STRINGS.YUYISCREEN15, string.format("%.0f/%.0f", player.skill_ULv0, 5), "hh" ,false ,nil})
    table.insert(spinners2, {STRINGS.YUYISCREEN16, string.format("%.0f/%.0f", player.skill_ILv0, 5), "hh" ,false ,nil})
    table.insert(spinners2, {STRINGS.YUYISCREEN17, string.format("%.0f/%.0f", player.skill_OLv0, 5), "hh" ,false ,nil})
    table.insert(spinners2, {STRINGS.YUYISCREEN18,nil, "hh" ,false ,nil})
    for k,v in ipairs(spinners2) do self.grid2:AddItem(self:CreateSpinnerGroup(v[1], v[2], v[3], v[4]), 1, k) end

	local function yuyiclosescreen()
		TheFrontEnd:PopScreen()
	end

	self.skillbutton1 = self.proot:AddChild(ImageButton())
	self.skillbutton1:SetText(STRINGS.YUYISCREEN19)
    self.skillbutton1:SetPosition(-80, 200, 0)
    self.skillbutton1:SetScale(0.4)
    self.skillbutton1:SetOnClick(
	function()
	local yuyi_doalog = PopupDialogScreen(
		STRINGS.YUYISCREEN_JIESHAO1,
		STRINGS.YUYISCREEN_JS_ZZ1..player.skill_RLv..STRINGS.YUYISCREEN_JS_ZZ2..TUNING.WILSON_WALK_SPEED..STRINGS.YUYISCREEN_JS_ZZ3..TUNING.WILSON_WALK_SPEED..STRINGS.YUYISCREEN_JS_ZZ4..player.skill_RLv..")*0.25+0.75",
	{ { text = STRINGS.YUYISCREEN26, cb = yuyiclosescreen } })
	yuyi_doalog:SetTitleTextSize(40)
	yuyi_doalog:SetButtonTextSize(30)
	yuyi_doalog.title:SetPosition(0, 100, 0)
	yuyi_doalog.text:SetSize(25)
	yuyi_doalog.text:SetRegionSize(900, 600)
	yuyi_doalog.text:SetPosition(150, 10, 0)
	yuyi_doalog.text:SetHAlign(ANCHOR_LEFT)
	yuyi_doalog.bg:SetScale(1.7, 1.5, 1.2)
	yuyi_doalog.menu:SetPosition(0, -100, 0)
	TheFrontEnd:PushScreen(yuyi_doalog)
	end
	)

	self.skillbutton2 = self.proot:AddChild(ImageButton())
	self.skillbutton2:SetText(STRINGS.YUYISCREEN19)
    self.skillbutton2:SetPosition(-80, 160, 0)
    self.skillbutton2:SetScale(0.4)
    self.skillbutton2:SetOnClick(
	function()
	local yuyi_doalog = PopupDialogScreen(
	STRINGS.YUYISCREEN_JIESHAO2,
	STRINGS.YUYISCREEN_JS_LH1..yuyi_weapondmg..STRINGS.YUYISCREEN_JS_LH2..yuyi_weapondmg..STRINGS.YUYISCREEN_JS_LH3..player.skill_JLv1..")*0.3",
	{ { text = STRINGS.YUYISCREEN26, cb = yuyiclosescreen } })
	yuyi_doalog:SetTitleTextSize(40)
	yuyi_doalog:SetButtonTextSize(30)
	yuyi_doalog.title:SetPosition(0, 100, 0)
	yuyi_doalog.text:SetSize(25)
	yuyi_doalog.text:SetRegionSize(900, 600)
	yuyi_doalog.text:SetPosition(150, 10, 0)
	yuyi_doalog.text:SetHAlign(ANCHOR_LEFT)
	yuyi_doalog.bg:SetScale(1.7, 1.5, 1.2)
	yuyi_doalog.menu:SetPosition(0, -100, 0)
	TheFrontEnd:PushScreen(yuyi_doalog)
	end
	)

	self.skillbutton3 = self.proot:AddChild(ImageButton())
	self.skillbutton3:SetText(STRINGS.YUYISCREEN19)
    self.skillbutton3:SetPosition(-80, 115, 0)
    self.skillbutton3:SetScale(0.4)
    self.skillbutton3:SetOnClick(
	function()
	local yuyi_doalog = PopupDialogScreen(
		STRINGS.YUYISCREEN_JIESHAO3,
		STRINGS.YUYISCREEN_JS_BY1..player.skill_KLv1..STRINGS.YUYISCREEN_JS_BY2..player.skill_KLv1..")*0.20",
	{ { text = STRINGS.YUYISCREEN26, cb = yuyiclosescreen } })
	yuyi_doalog:SetTitleTextSize(40)
	yuyi_doalog:SetButtonTextSize(30)
	yuyi_doalog.title:SetPosition(0, 100, 0)
	yuyi_doalog.text:SetSize(25)
	yuyi_doalog.text:SetRegionSize(900, 600)
	yuyi_doalog.text:SetPosition(150, 10, 0)
	yuyi_doalog.text:SetHAlign(ANCHOR_LEFT)
	yuyi_doalog.bg:SetScale(1.7, 1.5, 1.2)
	yuyi_doalog.menu:SetPosition(0, -100, 0)
	TheFrontEnd:PushScreen(yuyi_doalog)
	end
	)

	self.skillbutton4 = self.proot:AddChild(ImageButton())
	self.skillbutton4:SetText(STRINGS.YUYISCREEN19)
    self.skillbutton4:SetPosition(-80, 75, 0)
    self.skillbutton4:SetScale(0.4)
    self.skillbutton4:SetOnClick(
	function()
	local yuyi_doalog = PopupDialogScreen(
		STRINGS.YUYISCREEN_JIESHAO4,
		STRINGS.YUYISCREEN_JS_ZR1..yuyi_weapondmg..STRINGS.YUYISCREEN_JS_ZR2..player.skill_LLv1..")*10+30",
	{ { text = STRINGS.YUYISCREEN26, cb = yuyiclosescreen } })
	yuyi_doalog:SetTitleTextSize(40)
	yuyi_doalog:SetButtonTextSize(30)
	yuyi_doalog.title:SetPosition(0, 100, 0)
	yuyi_doalog.text:SetSize(25)
	yuyi_doalog.text:SetRegionSize(900, 600)
	yuyi_doalog.text:SetPosition(150, 10, 0)
	yuyi_doalog.text:SetHAlign(ANCHOR_LEFT)
	yuyi_doalog.bg:SetScale(1.7, 1.5, 1.2)
	yuyi_doalog.menu:SetPosition(0, -100, 0)
	TheFrontEnd:PushScreen(yuyi_doalog)
	end
	)

	self.skillbutton5 = self.proot:AddChild(ImageButton())
	self.skillbutton5:SetText(STRINGS.YUYISCREEN19)
    self.skillbutton5:SetPosition(-80, 30, 0)
    self.skillbutton5:SetScale(0.4)
    self.skillbutton5:SetOnClick(
	function()
	local yuyi_doalog = PopupDialogScreen(
		STRINGS.YUYISCREEN_JIESHAO5,
		STRINGS.YUYISCREEN_JS_HX1..player.skill_ULv1..STRINGS.YUYISCREEN_JS_HX2..yuyi_weapondmg..")/4",
	{ { text = STRINGS.YUYISCREEN26, cb = yuyiclosescreen } })
	yuyi_doalog:SetTitleTextSize(40)
	yuyi_doalog:SetButtonTextSize(30)
	yuyi_doalog.title:SetPosition(0, 100, 0)
	yuyi_doalog.text:SetSize(25)
	yuyi_doalog.text:SetRegionSize(900, 600)
	yuyi_doalog.text:SetPosition(150, 10, 0)
	yuyi_doalog.text:SetHAlign(ANCHOR_LEFT)
	yuyi_doalog.bg:SetScale(1.7, 1.5, 1.2)
	yuyi_doalog.menu:SetPosition(0, -100, 0)
	TheFrontEnd:PushScreen(yuyi_doalog)
	end
	)

	self.skillbutton6 = self.proot:AddChild(ImageButton())
	self.skillbutton6:SetText(STRINGS.YUYISCREEN19)
    self.skillbutton6:SetPosition(-80, -10, 0)
    self.skillbutton6:SetScale(0.4)
    self.skillbutton6:SetOnClick(
	function()
	local yuyi_doalog = PopupDialogScreen(
		STRINGS.YUYISCREEN_JIESHAO6,
		STRINGS.YUYISCREEN_JS_DJ1..player.skill_ILv1..")*5+5",
	{ { text = STRINGS.YUYISCREEN26, cb = yuyiclosescreen } })
	yuyi_doalog:SetTitleTextSize(40)
	yuyi_doalog:SetButtonTextSize(30)
	yuyi_doalog.title:SetPosition(0, 100, 0)
	yuyi_doalog.text:SetSize(25)
	yuyi_doalog.text:SetRegionSize(900, 600)
	yuyi_doalog.text:SetPosition(150, 10, 0)
	yuyi_doalog.text:SetHAlign(ANCHOR_LEFT)
	yuyi_doalog.bg:SetScale(1.7, 1.5, 1.2)
	yuyi_doalog.menu:SetPosition(0, -100, 0)
	TheFrontEnd:PushScreen(yuyi_doalog)
	end
	)

	self.skillbutton7 = self.proot:AddChild(ImageButton())
	self.skillbutton7:SetText(STRINGS.YUYISCREEN19)
    self.skillbutton7:SetPosition(-80, -50, 0)
    self.skillbutton7:SetScale(0.4)
    self.skillbutton7:SetOnClick(
	function()
	local yuyi_doalog = PopupDialogScreen(
		STRINGS.YUYISCREEN_JIESHAO7,
		STRINGS.YUYISCREEN_JS_HH1..player.skill_ULv1..")*5+25",
	{ { text = STRINGS.YUYISCREEN26, cb = yuyiclosescreen } })
	yuyi_doalog:SetTitleTextSize(40)
	yuyi_doalog:SetButtonTextSize(30)
	yuyi_doalog.title:SetPosition(0, 100, 0)
	yuyi_doalog.text:SetSize(25)
	yuyi_doalog.text:SetRegionSize(900, 600)
	yuyi_doalog.text:SetPosition(150, 10, 0)
	yuyi_doalog.text:SetHAlign(ANCHOR_LEFT)
	yuyi_doalog.bg:SetScale(1.7, 1.5, 1.2)
	yuyi_doalog.menu:SetPosition(0, -100, 0)
	TheFrontEnd:PushScreen(yuyi_doalog)
	end
	)

	self.skillbutton8 = self.proot:AddChild(ImageButton())
	self.skillbutton8:SetText(STRINGS.YUYISCREEN19)
    self.skillbutton8:SetPosition(200, 200, 0)
    self.skillbutton8:SetScale(0.4)
    self.skillbutton8:SetOnClick(
	function()
	local yuyi_doalog = PopupDialogScreen(
		STRINGS.YUYISCREEN_JIESHAO8,
		STRINGS.YUYISCREEN_JS_LD1..yuyi_weapondmg..STRINGS.YUYISCREEN_JS_LD2..player.skill_JLv0..")*5",
	{ { text = STRINGS.YUYISCREEN26, cb = yuyiclosescreen } })
	yuyi_doalog:SetTitleTextSize(40)
	yuyi_doalog:SetButtonTextSize(30)
	yuyi_doalog.title:SetPosition(0, 100, 0)
	yuyi_doalog.text:SetSize(25)
	yuyi_doalog.text:SetRegionSize(900, 600)
	yuyi_doalog.text:SetPosition(150, 10, 0)
	yuyi_doalog.text:SetHAlign(ANCHOR_LEFT)
	yuyi_doalog.bg:SetScale(1.7, 1.5, 1.2)
	yuyi_doalog.menu:SetPosition(0, -100, 0)
	TheFrontEnd:PushScreen(yuyi_doalog)
	end
	)

	self.skillbutton9 = self.proot:AddChild(ImageButton())
	self.skillbutton9:SetText(STRINGS.YUYISCREEN19)
    self.skillbutton9:SetPosition(200, 160, 0)
    self.skillbutton9:SetScale(0.4)
    self.skillbutton9:SetOnClick(
	function()
	local yuyi_doalog = PopupDialogScreen(
		STRINGS.YUYISCREEN_JIESHAO9,
		STRINGS.YUYISCREEN_JS_MD1..player.skill_KLv0..STRINGS.YUYISCREEN_JS_MD2..player.skill_KLv0..STRINGS.YUYISCREEN_JS_MD3,
	{ { text = STRINGS.YUYISCREEN26, cb = yuyiclosescreen } })
	yuyi_doalog:SetTitleTextSize(40)
	yuyi_doalog:SetButtonTextSize(30)
	yuyi_doalog.title:SetPosition(0, 100, 0)
	yuyi_doalog.text:SetSize(25)
	yuyi_doalog.text:SetRegionSize(900, 600)
	yuyi_doalog.text:SetPosition(150, 10, 0)
	yuyi_doalog.text:SetHAlign(ANCHOR_LEFT)
	yuyi_doalog.bg:SetScale(1.7, 1.5, 1.2)
	yuyi_doalog.menu:SetPosition(0, -100, 0)
	TheFrontEnd:PushScreen(yuyi_doalog)
	end
	)

	self.skillbutton10 = self.proot:AddChild(ImageButton())
	self.skillbutton10:SetText(STRINGS.YUYISCREEN19)
    self.skillbutton10:SetPosition(200, 115, 0)
    self.skillbutton10:SetScale(0.4)
    self.skillbutton10:SetOnClick(
	function()
	local yuyi_doalog = PopupDialogScreen(
		STRINGS.YUYISCREEN_JIESHAO10,
		STRINGS.YUYISCREEN_JS_HQ1..player.skill_LLv0..")*8",
	{ { text = STRINGS.YUYISCREEN26, cb = yuyiclosescreen } })
	yuyi_doalog:SetTitleTextSize(40)
	yuyi_doalog:SetButtonTextSize(30)
	yuyi_doalog.title:SetPosition(0, 100, 0)
	yuyi_doalog.text:SetSize(25)
	yuyi_doalog.text:SetRegionSize(900, 600)
	yuyi_doalog.text:SetPosition(150, 10, 0)
	yuyi_doalog.text:SetHAlign(ANCHOR_LEFT)
	yuyi_doalog.bg:SetScale(1.7, 1.5, 1.2)
	yuyi_doalog.menu:SetPosition(0, -100, 0)
	TheFrontEnd:PushScreen(yuyi_doalog)
	end
	)

	self.skillbutton11 = self.proot:AddChild(ImageButton())
	self.skillbutton11:SetText(STRINGS.YUYISCREEN19)
    self.skillbutton11:SetPosition(200, 70, 0)
    self.skillbutton11:SetScale(0.4)
    self.skillbutton11:SetOnClick(
	function()
	local yuyi_doalog = PopupDialogScreen(
		STRINGS.YUYISCREEN_JIESHAO11,
		STRINGS.YUYISCREEN_JS_DL1..player.skill_ULv0..STRINGS.YUYISCREEN_JS_DL2,
	{ { text = STRINGS.YUYISCREEN26, cb = yuyiclosescreen } })
	yuyi_doalog:SetTitleTextSize(40)
	yuyi_doalog:SetButtonTextSize(30)
	yuyi_doalog.title:SetPosition(0, 100, 0)
	yuyi_doalog.text:SetSize(25)
	yuyi_doalog.text:SetRegionSize(900, 600)
	yuyi_doalog.text:SetPosition(150, 10, 0)
	yuyi_doalog.text:SetHAlign(ANCHOR_LEFT)
	yuyi_doalog.bg:SetScale(1.7, 1.5, 1.2)
	yuyi_doalog.menu:SetPosition(0, -100, 0)
	TheFrontEnd:PushScreen(yuyi_doalog)
	end
	)

	self.skillbutton12 = self.proot:AddChild(ImageButton())
	self.skillbutton12:SetText(STRINGS.YUYISCREEN19)
    self.skillbutton12:SetPosition(200, 30, 0)
    self.skillbutton12:SetScale(0.4)
    self.skillbutton12:SetOnClick(
	function()
	local yuyi_doalog = PopupDialogScreen(
		STRINGS.YUYISCREEN_JIESHAO12,
		STRINGS.YUYISCREEN_JS_BX1..player.skill_ILv0..STRINGS.YUYISCREEN_JS_BX2,
	{ { text = STRINGS.YUYISCREEN26, cb = yuyiclosescreen } })
	yuyi_doalog:SetTitleTextSize(40)
	yuyi_doalog:SetButtonTextSize(30)
	yuyi_doalog.title:SetPosition(0, 100, 0)
	yuyi_doalog.text:SetSize(25)
	yuyi_doalog.text:SetRegionSize(900, 600)
	yuyi_doalog.text:SetPosition(150, 10, 0)
	yuyi_doalog.text:SetHAlign(ANCHOR_LEFT)
	yuyi_doalog.bg:SetScale(1.7, 1.5, 1.2)
	yuyi_doalog.menu:SetPosition(0, -100, 0)
	TheFrontEnd:PushScreen(yuyi_doalog)
	end
	)

	self.skillbutton13 = self.proot:AddChild(ImageButton())
	self.skillbutton13:SetText(STRINGS.YUYISCREEN19)
    self.skillbutton13:SetPosition(200, -10, 0)
    self.skillbutton13:SetScale(0.4)
    self.skillbutton13:SetOnClick(
	function()
	local yuyi_doalog = PopupDialogScreen(
		STRINGS.YUYISCREEN_JIESHAO13,
		STRINGS.YUYISCREEN_JS_ZH1..player.skill_OLv0..")*0.5+0.5",
	{ { text = STRINGS.YUYISCREEN26, cb = yuyiclosescreen } })
	yuyi_doalog:SetTitleTextSize(40)
	yuyi_doalog:SetButtonTextSize(30)
	yuyi_doalog.title:SetPosition(0, 100, 0)
	yuyi_doalog.text:SetSize(25)
	yuyi_doalog.text:SetRegionSize(900, 600)
	yuyi_doalog.text:SetPosition(150, 10, 0)
	yuyi_doalog.text:SetHAlign(ANCHOR_LEFT)
	yuyi_doalog.bg:SetScale(1.7, 1.5, 1.2)
	yuyi_doalog.menu:SetPosition(0, -100, 0)
	TheFrontEnd:PushScreen(yuyi_doalog)
	end
	)

	self.textbutton = self.proot:AddChild(ImageButton())
	self.textbutton:SetText(STRINGS.YUYISCREEN20)
    self.textbutton:SetPosition(-80, -135, 0)
    self.textbutton:SetScale(0.4)
    self.textbutton:SetOnClick(
	function()
	if GetPlayer().HUD and GetPlayer().HUD.yuyi_nandu then
	if GetPlayer():HasTag("yiyucharacter") then
		GetPlayer():RemoveTag("yiyucharacter")
		GetPlayer().HUD.yuyi_nandu:Hide()
		GetPlayer().HUD.yuyi_buff:Hide()
	else
	GetPlayer():AddTag("yiyucharacter")
		GetPlayer().HUD.yuyi_nandu:Show()
		GetPlayer().HUD.yuyi_buff:Show()
	end
	end
	end)

	self.vistbutton = self.proot:AddChild(ImageButton())
	self.vistbutton:SetText(STRINGS.YUYISCREEN21)
    self.vistbutton:SetPosition(65, -95, 0)
    self.vistbutton:SetScale(0.4)
    self.vistbutton:SetOnClick( function() VisitURL("https://tieba.baidu.com/p/5216202271?pn=1") end)

	self.vistbutton = self.proot:AddChild(ImageButton())
	self.vistbutton:SetText(STRINGS.YUYISCREEN22)
    self.vistbutton:SetPosition(65, -135, 0)
    self.vistbutton:SetScale(0.4)
    self.vistbutton:SetOnClick( function() VisitURL("http://steamcommunity.com/sharedfiles/filedetails/?id=642704851") end)

	self.vistbutton = self.proot:AddChild(ImageButton())
	self.vistbutton:SetText(STRINGS.YUYISCREEN23)
    self.vistbutton:SetPosition(155, -95, 0)
    self.vistbutton:SetScale(0.4)
    self.vistbutton:SetOnClick( function() self:Close() player.components.talker:Say(STRINGS.YUYISCREEN24) end)

    self.menu = self.proot:AddChild(Menu(nil, 200, true))
    self.menu:SetPosition(155, -135 ,0)
    self.menu:SetScale(0.4)
    self.menu:AddItem(STRINGS.YUYISCREEN25, function() self:Close() end)
end)

function YuyiScreen:CreateSpinnerGroup( text, text2 , text3 ,button,fn)
    local label_width = 290
    local group = Widget("SpinnerGroup")
    local label = group:AddChild( Text( textfont, fontsize2, text ) )
    label:SetPosition( 0, 0, 0 )
    label:SetRegionSize( label_width, fontsize2 )
    label:SetHAlign( ANCHOR_LEFT )
    label:SetColour(0,0.75,1,1)
	
    local label2 = group:AddChild( Text( textfont, fontsize2, text2 ) )
    label2:SetPosition( 0, 0, 0 )
    label2:SetRegionSize( label_width, fontsize2 )
    label2:SetHAlign( ANCHOR_MIDDLE )
    label2:SetColour(0,0.75,1,1)

    if button then
        local label3 = group:AddChild(Menu(nil, 200, true))
        label3:SetPosition( 100, 0, 0 )
        label3:SetScale(0.6)
        label3:SetHRegPoint(ANCHOR_RIGHT)
        label3:AddItem(text3, function()
            if fn then
                fn()

            end
         end)
    end

    return group
end

function YuyiScreen:Close()
    self.active = false
    SetPause(false)
    TheFrontEnd:PopScreen()
end 

function YuyiScreen:OnControl(control, down)
    if YuyiScreen._base.OnControl(self, control, down) then return true end
    if not down and  control == CONTROL_CANCEL then
        self:Close()
        return true
    end
    return false
end


return YuyiScreen