using K3DAsyncEngineLib;
using lol_coder.Data;
using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;

using System.Threading.Tasks;
using System.Windows.Forms;
using static lol_coder.Data.DataControl;

namespace lol_coder.Tornado
{
    public class TornadoManager
    {
        bool forTest;

        public void DisplayTest()
        {
            forTest = !forTest;

            KAScene = KAEngine.LoadScene(@"E:\김의연\신세계TV쇼핑\디자인\23_라이브톡 (1)\우하단_테스트.t2s","우하단테스트");
            eKSceneEffectType etype = eKSceneEffectType.SCENE_CHANGE_EFFECT_FADE;
            KAScene.SetSceneEffectType(1, etype, FadeInSec);

            if (forTest)
            {
                SetValue("test", @"C:\Users\MD\Downloads\sample_960x400_ocean_with_audio.avi");
                //KAScene.GetObject("test").SetStartFrame(300);
                //KAScene.GetObject("test").SetKeyFrame(eKObjectAttribute.ATTR_ANIMATION_BEGIN, 0, 10, eKKeyFrameType.KEY_FRAME_TYPE_ABSOLUTE);
            }
            else
            {
                SetValue("test", @"C:\Users\MD\Downloads\sample_1280x720_surfing_with_audio.avi");
                KAScene.GetObject("test").SetVideoFrame(300000, 3000000);
                //KAScene.GetObject("test").SetStartFrame(300);
                //SetValue("test", "sample_1280x720.avi");
                //KAScene.GetObject("test").SetKeyFrame(eKObjectAttribute.ATTR_ANIMATION_BEGIN, 0, 0, eKKeyFrameType.KEY_FRAME_TYPE_ABSOLUTE);
            }

            Prepare(layoutBaronTimer);
            Play(layoutBaronTimer);
        }
            


        #region variables

        protected KAEngine KAEngine;
        protected KAScenePlayer KAScenePlayer;
        protected KAScene KAScene;
        protected K3DEventHandler KAEvent;

        public string IP { get; set; } = "127.0.0.1";
        public int Port { get; set; } = 30001;

        public int DissolveTime { get; set; } = 3;
        public string DesignPath { get; set; } = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\Design";

        public bool isConnected()
        {
            if (KAScenePlayer == null) return false;
            else return true;
        }


        #endregion


        #region singleton 

        private static TornadoManager uniqueInstance = null;
        private static readonly Object mInstanceLocker = new Object();

        public static TornadoManager getInstance()
        {
            lock (mInstanceLocker)
            {
                if (uniqueInstance == null)
                {
                    uniqueInstance = new TornadoManager();
                }
            }
            return uniqueInstance;
        }

        public TornadoManager()
        {
            KAEngine = new KAEngine();
        }

        #endregion


        #region Method

        public void UnLoadAll()
        {
            KAEngine.UnloadAll();
        }

        public void UnLoadMain()
        { 
            KAEngine.UnloadScene(sceneNameBanPick);
            KAEngine.UnloadScene(sceneNameBanPick_old);
            KAEngine.UnloadScene(sceneNameBanPickManual);
            KAEngine.UnloadScene(sceneNameLineUp);
            KAEngine.UnloadScene(sceneNameTowerGold);
            KAEngine.UnloadScene(sceneNameAllRunes);
            KAEngine.UnloadScene(sceneNameKeyStone);
            KAEngine.UnloadScene(sceneNameWinRate);
            KAEngine.UnloadScene(sceneNamePost);
            KAEngine.UnloadScene(sceneNamePOG);  
        }


        #region Method - Connection
        public void setMainFrom(MainForm _mainForm)
        {
            KAEvent = new K3DEventHandler(_mainForm);
        }
        public void Connection()
        {
            KAEngine.KTAPConnect(1, IP, Port, 0, KAEvent);
            KAScenePlayer = KAEngine.GetScenePlayer();
        }
        public void AliveCheck()
        {
            KAEngine.HeartBeat();
        }

        #endregion


        #region Method - SceneControl

        int sceneCount = 0;
        string _designPath = Environment.CurrentDirectory + @"\T2S\";
        private string designPath(string cutName) => _designPath + cutName + ".t2s";

        private string vrvPath(string vrvName) => _designPath + @"Video\" + vrvName + ".vrv";
        private string imagePath(string imgName) => _designPath + @"Images\" + imgName + ".tga";

        private string resPath(string resName) => Environment.CurrentDirectory + @"\res\" + resName + ".png";

        private string sceneName(string _s)
        {
            sceneCount++;

            return _s + sceneCount;
        }

        public void LoadScene(string fileName) => KAScene = KAEngine.LoadScene(designPath(fileName), fileName);
        public void Prepare(int layer) => KAScenePlayer.Prepare(layer, KAScene);
        public void Play(int layer) => KAScenePlayer.Play(layer);


        public void Out(int layer)
        {
            //=> KAScenePlayer.PlayOut(layer);
            eKSceneEffectType etype = eKSceneEffectType.SCENE_CHANGE_EFFECT_FADE;            

            KAScene = KAEngine.LoadScene(designPath("Clear"), "Clear");
            KAScene.SetSceneEffectType(1, etype, FadeInSec);

            KAScenePlayer.Prepare(layer, KAScene);
            KAScenePlayer.Play(layer);
        }

        public void SetValue(string objName, string value) => KAScene.GetObject(objName).SetValue(value);

        public void SetVisible(string objName, bool visible) => KAScene.GetObject(objName).SetVisible(visible ? 1 : 0);

        public void Preview(string path)
        {
            KAScenePlayer.SavePreviewImage(path, 320, 240);
        }

        #endregion


        #region Method - Coder

        public int FadeInSec = 12;
        string RES_FOLDER_PATH = Environment.CurrentDirectory + @"\Resource\";

        private readonly int mainLayer = 1;

        public bool isDisplayBanPick = false;
        public bool isDisplayGold = false;
        public bool isDisplayGoldGraph = false;
        public bool isDisplayDeal = false;
        public bool isDisplayFight = false;
        public bool isDisplayFightRealTime = false;
        public bool isDisplayTowerGold = false;
        private readonly string sceneNameBanPick = "밴픽_2024";
        private readonly string sceneNameBanPick_old = "밴픽";
        private readonly string sceneNameBanPickManual = "벤픽스틸";
        private readonly string sceneNameLineUp = "라인업1";
        private readonly string sceneNameQuest = "Rolequest";
        private readonly string sceneNameGold = "누적골드";
        private readonly string sceneNameGoldGraph = "입힌피해";
        private readonly string sceneNameDeal = "한타딜량"; //누적데미지
        private readonly string sceneNameFight = "한타"; //한타딜량
        private readonly string sceneNameFightNew = "실시간한타"; //한타딜량
        private readonly string sceneNamePost = "경기결과";
        private readonly string sceneNamePOG = "POM";//"Player of the game";

        private readonly string sceneNameTowerGold = "포탑골드";
        private readonly string sceneNameAllRunes = "선수별 룬";
        private readonly string sceneNameKeyStone = "키스톤룬";
        private readonly string sceneNameWinRate = "챔프승률";

        private readonly int layoutScore = 2;
        private readonly string sceneNameScore = "상단스코어판";

        public bool isDisplayDragon = false;
        private readonly string sceneNameDragon = "용획득";
        private readonly int layoutDragon = 3;
        //용획득 이미지 경로
        public string[] bbufD = new string[10];
        public string[] rbufD = new string[10];
        public string rAtakhan = "";
        public string bAtakhan = "";

        public bool isDisplayDragonTimer = false;
        private readonly int layoutDragonTimer = 4;
        private readonly string sceneNameDragonTimer = "용 타이머";

        public bool isDisplayElderTimer = false;
        private readonly int layoutElderTimer = 4;
        private readonly string sceneNameElderTimerBlue = "B_Elder";
        private readonly string sceneNameElderTimerRed = "R_Elder";

        public bool isDisplayTower = false;
        private readonly int layoutTower = 5;
        private readonly string sceneNameTower = "Tower";


        public bool isDisplayAtakanTimer = false;
        private readonly int layoutAtakanTimer = 5;
        private readonly string sceneNameAtakanTimer = "아타칸타이머";


        public bool isDisplayHeraldTimer = false;
        private readonly int layoutHeraldTimer = 9;
        private readonly string sceneNameHeraldTimer = "전령타이머";

        public bool isDisplayHordeTimer = false;
        private readonly int layoutHordeTimer = 6;
        private readonly string sceneNameHordeTimer = "공허유충 타이머";

        public bool isDisplayBaronTimer = false;
        private readonly int layoutBaronTimer = 6;
        private readonly string sceneNameBaronTimer = "바론 타이머";

        public bool isDisplayBraonBuff = false;
        public bool isDisplayBaronPowerPlay = false;
        private readonly int layoutBaronBuff = 9;
        //private readonly string sceneNameBaronBuff = "바론 버프";
        private readonly string sceneNameBaronBuffBlue = "B_Baron";
        private readonly string sceneNameBaronBuffRed = "R_Baron";
        /*        
        private readonly int layoutBaronPowerPlay = 5;
        private readonly string sceneNameBaronPowerPlayBlue = "B_Power";
        private readonly string sceneNameBaronPowerPlayRed = "R_Power";
        */



        public bool isDisplayInhibitorBlue = false;
        private readonly int layoutInhibitorBlue = 7;
        private readonly string sceneNameInhibitorBlue = "억제기타이머_B";
        public bool isDisplayInhibitorRed = false;
        private readonly int layoutInhibitorRed = 8;
        private readonly string sceneNameInhibitorRed = "억제기타이머_R";


        #region 밴픽

        public int TimerTime = 27;
        public Timer timer = new Timer();

        public void timer_Tick(object sender, EventArgs e)
        {
            if (TimerTime == 1) timer.Stop();

            TimerTime--;

            KAScene = KAScenePlayer.GetPlayingScene(1);
            KAEngine.BeginTransaction();
            if (TimerTime > -1) KAScene.GetObject("Timer").SetValue("" + string.Format("{0:00}", TimerTime));
            KAEngine.EndTransaction();
            KAScenePlayer.Prepare(1, KAScene);
        }

        public bool isBanPickStart = false;
        public string bScore = "";
        public string rScore = "";
        public string bScoreAll = "";
        public string rScoreAll = "";

        
        public void DisplayBanPick(string[] titles, string[] teams, DataControl dc, string[] scores, bool[] isFearless, string[] images1, string[] images2, string[] images3, string[] images4, bool isRedStart)
        {
            if (isRedStart) LoadScene(sceneNameBanPick + "_R");
            else             LoadScene(sceneNameBanPick);

            isBanPickStart = false;
            /*
            timer = new Timer();
            timer.Interval = 1000;
            timer.Tick += new EventHandler(timer_Tick);
            */

            for (int i = 0; i < 4; i++)
            {
                SetVisible("game" + (i + 1), isFearless[i]); 
            }

            //KAScene.GetObject("B_Pick_Ready1".SetImageType();
            //KAScene.GetObject("B_Pick1".SetImageType();
            

            for (int i = 0; i < 10; i++)
            {
                if (isFearless[0])
                {
                    if (i < 5) KAScene.GetObject("g1b" + (i + 1)).SetValue(images1[i]);
                    else KAScene.GetObject("g1r" + (i - 4)).SetValue(images1[i]);
                }
                if (isFearless[1])
                {
                    if (i < 5) KAScene.GetObject("g2b" + (i + 1)).SetValue(images2[i]);
                    else KAScene.GetObject("g2r" + (i - 4)).SetValue(images2[i]);
                }
                if (isFearless[2])
                {
                    if (i < 5) KAScene.GetObject("g3b" + (i + 1)).SetValue(images3[i]);
                    else KAScene.GetObject("g3r" + (i - 4)).SetValue(images3[i]);
                }
                if (isFearless[3])
                {
                    if (i < 5) KAScene.GetObject("g4b" + (i + 1)).SetValue(images4[i]);
                    else KAScene.GetObject("g4r" + (i - 4)).SetValue(images4[i]);
                }
            }

            bScore = scores[0];
            rScore = scores[1];
            bScoreAll = scores[2];
            rScoreAll = scores[3];

            for (int i = 0; i < 5; i++)
            {
                KAScene.GetObject("B_Pick_Player_Name" + (i + 1)).SetValue(dc.BlueLiner.GetLiner(i).Name);
                KAScene.GetObject("R_Pick_Player_Name" + (i + 1)).SetValue(dc.RedLiner.GetLiner(i).Name);

                SetVisible("B_Pick_Ready" + (i + 1), false);
                SetVisible("R_Pick_Ready" + (i + 1), false);
            }


            KAScene.GetObject("B_Team_Logo").SetValue(RES_FOLDER_PATH + "Team Logo(1080x1080)\\" + teams[0] + ".png");
            KAScene.GetObject("R_Team_Logo").SetValue(RES_FOLDER_PATH + "Team Logo(1080x1080)\\" + teams[1] + ".png");

            KAScene.GetObject("B_Team_Name").SetValue(teams[0]);
            KAScene.GetObject("R_Team_Name").SetValue(teams[1]);
             

            KAScene.GetObject("Timer").SetValue("27");
            KAScene.GetObject("Match").SetValue(titles[0]);
            KAScene.GetObject("Patch").SetValue(titles[1]);
            KAScene.GetObject("Version").SetValue(titles[2]);

            KAScene.GetObject("BScore").SetValue(bScore);
            KAScene.GetObject("RScore").SetValue(rScore);
            KAScene.GetObject("BScoreAll").SetValue(bScoreAll);
            KAScene.GetObject("RScoreAll").SetValue(rScoreAll);


            //애니메이션 처리
            for (int i = 1; i <= 5; i++)
            {
                SetVisible("B_Ban_Color_Box" + i, false);
                SetVisible("R_Ban_Color_Box" + i, false);

                SetVisible("B_Pick_Color_Box" + i, false);
                SetVisible("R_Pick_Color_Box" + i, false);
                 
            }

            if (isRedStart) SetVisible("R_Ban_Color_Box1", true);
            else SetVisible("B_Ban_Color_Box1", true);




            /*
            //트리거--- 홀드 지정
            for (int i = 1; i <= 5; i++)
            {
                KAScene.AddPauseByName("B_Ban" + i.ToString(), 1500, 0, 0);
                KAScene.AddPauseByName("R_Ban" + i.ToString(), 1500, 0, 0);

                KAScene.AddPauseByName("B_Pick" + i.ToString(), 1500, 0, 0);
                KAScene.AddPauseByName("R_Pick" + i.ToString(), 1500, 0, 0);

                KAScene.AddPauseByName("B Pick" + i.ToString() + "_1", 60, 0, 0);
                KAScene.AddPauseByName("R Pick" + i.ToString() + "_1", 60, 0, 0);

            }
            */
            isDisplayBanPick = true;
            
            /*
            KAScene.GetObject("BScore").SetVisible(1);
            KAScene.GetObject("RScore").SetVisible(1);
            KAScene.GetObject("BScore").SetValue(bScore);
            KAScene.GetObject("RScore").SetValue(rScore);
            KAScene.GetObject("BScoreAll").SetValue(bScoreAll);
            KAScene.GetObject("RScoreAll").SetValue(rScoreAll);
            */


            Prepare(mainLayer);
            Play(mainLayer);

            PickTriggerShown = new bool[] { false, false, false, false, false, false, false, false, false, false, false };
        }

        public void DisplayBanPickStart(int index, string[] values, bool isBan, bool isRedStart = false)
        {
            //임시 디버깅용
            //if (values != null) if (values.Count() > 2) if (values[2] == "선택확정") { values[2] = "고르는중"; }
            
            

            string strs = "";
            if (values != null)
            {
                foreach (var v in values)
                {
                    strs += " " + v;
                }
            }
            Console.WriteLine("BanPick 시작" + "Index : " + index + "string : " + strs + "IsBan : " + isBan);

            if (isRedStart) //레드 시작시
            {
                if (isBan)
                {
                    void setBanObj(string tag)
                    {
                        LoadScene("30SecTimer");
                        Prepare(2);
                        Play(2);

                        KAScene = KAScenePlayer.GetPlayingScene(1);
                        KAEngine.BeginTransaction();
                        KAScene.GetObject(tag[0] + "_Ban" + tag[1]).SetValue(values[0]);
                        KAScene.GetObject(tag[0] + "_Ban_Color_Box" + tag[1]).SetVisible(0);
                        KAEngine.EndTransaction();

                        KAScenePlayer.Play(1);
                    }

                    if (index.Equals(0))
                    {
                        Console.WriteLine("R_Ban1");
                        LoadScene("30SecTimer");
                        Prepare(2);
                        Play(2);
                        System.Threading.Thread.Sleep(2000);
                    }
                    else if (index.Equals(1))
                    {
                        setBanObj("R1");
                        KAScene.GetObject("B_Ban_Color_Box1").SetVisible(1);
                        Console.WriteLine("B_Ban1");
                        System.Threading.Thread.Sleep(2000);
                    }
                    else if (index.Equals(2))
                    {
                        setBanObj("B1");
                        KAScene.GetObject("R_Ban_Color_Box2").SetVisible(1);
                        Console.WriteLine("R_Ban2");
                        System.Threading.Thread.Sleep(2000);
                    }
                    else if (index.Equals(3))
                    {
                        setBanObj("R2");
                        KAScene.GetObject("B_Ban_Color_Box2").SetVisible(1);
                        Console.WriteLine("B_Ban2");
                        System.Threading.Thread.Sleep(2000);
                    }
                    else if (index.Equals(4))
                    {
                        setBanObj("B2");
                        KAScene.GetObject("R_Ban_Color_Box3").SetVisible(1);
                        Console.WriteLine("R_Ban3");
                        System.Threading.Thread.Sleep(2000);
                    }
                    else if (index.Equals(5))
                    {
                        setBanObj("R3");
                        KAScene.GetObject("B_Ban_Color_Box3").SetVisible(1);
                        Console.WriteLine("B_Ban3");
                        System.Threading.Thread.Sleep(2000);
                    }
                    else if (index.Equals(6))
                    {
                        setBanObj("B3");
                        KAScene.GetObject("R_Pick_Color_Box1").SetVisible(1);
                        Console.WriteLine("R_Pick1");
                        System.Threading.Thread.Sleep(2000);

                    }
                    else if (index.Equals(7))
                    {
                        setBanObj("B4");
                        KAScene.GetObject("R_Ban_Color_Box4").SetVisible(1);
                        Console.WriteLine("R_Ban4");
                        System.Threading.Thread.Sleep(2000);
                    }
                    else if (index.Equals(8))
                    {
                        setBanObj("R4");
                        KAScene.GetObject("B_Ban_Color_Box5").SetVisible(1);
                        Console.WriteLine("B_Ban5");
                        System.Threading.Thread.Sleep(2000);
                    }
                    else if (index.Equals(9))
                    {
                        setBanObj("B5");
                        KAScene.GetObject("R_Ban_Color_Box5").SetVisible(1);
                        Console.WriteLine("R_Ban5");
                        System.Threading.Thread.Sleep(2000);
                    }
                    else if (index.Equals(10))
                    {
                        setBanObj("R5");
                        KAScene.GetObject("B_Pick_Color_Box4").SetVisible(1);
                        Console.WriteLine("B_Pick4");
                        System.Threading.Thread.Sleep(2000);
                    }

                }
                else
                {
                    void SetPickObj(string tag)
                    {

                        if (values[2].Equals("고르는중"))
                        {
                            KAScene = KAScenePlayer.GetPlayingScene(1);
                            KAEngine.BeginTransaction();

                            SetVisible(tag[0] + "_Pick_Ready" + tag[1], true);
                            SetValue(tag[0] + "_Pick_Ready" + tag[1], values[0]);

                            Console.WriteLine(tag[0] + " Pick" + tag[1] + "_1");
                            KAEngine.EndTransaction();
                        }


                        if (values[2].Equals("선택확정"))
                        {
                            LoadScene(tag == "B5" ? "60SecTimer" : "30SecTimer");
                            Prepare(2);
                            Play(2);

                            KAScene = KAScenePlayer.GetPlayingScene(1);
                            KAEngine.BeginTransaction();


                            SetVisible(tag[0] + "_Pick_Ready" + tag[1], true);
                            SetValue(tag[0] + "_Pick_Ready" + tag[1], values[0]);
                            KAScene.GetObject(tag[0] + "_Pick_Color_Box" + tag[1]).SetVisible(0);
                            SetValue(tag[0] + "_Pick" + tag[1], values[0]);
                            //KAScene.GetObject(tag).SetVisible(0);
                            //KAScene.GetObject(tag[0] + "_Pick" + tag[1]).SetValue(values[0]); 
                            Console.WriteLine(tag[0] + " Pick" + tag[1] + "_1");



                            KAEngine.EndTransaction();
                            KAScenePlayer.Play(1);
                        }



                        //if (values[2].Equals("선택확정")) System.Threading.Thread.Sleep(2000);
                    }

                    if (index.Equals(0))
                    {
                        SetPickObj("R1");
                        if (values[2].Equals("선택확정"))
                        {
                            KAScene.GetObject("B_Pick_Color_Box1").SetVisible(1);
                            Console.WriteLine("B_Pick1");
                            System.Threading.Thread.Sleep(2000);
                        }
                    }
                    else if (index.Equals(1))
                    {
                        SetPickObj("B1");
                        if (values[2].Equals("선택확정"))
                        {
                            KAScene.GetObject("B_Pick_Color_Box2").SetVisible(1);
                            Console.WriteLine("B_Pick2");
                            System.Threading.Thread.Sleep(2000);
                        }
                    }
                    else if (index.Equals(2))
                    {
                        SetPickObj("B2");
                        if (values[2].Equals("선택확정"))
                        {
                            KAScene.GetObject("R_Pick_Color_Box2").SetVisible(1);
                            Console.WriteLine("R_Pick2");
                            System.Threading.Thread.Sleep(2000);
                        }
                    }
                    else if (index.Equals(3))
                    {
                        SetPickObj("R2");
                        if (values[2].Equals("선택확정"))
                        {
                            KAScene.GetObject("R_Pick_Color_Box3").SetVisible(1);
                            Console.WriteLine("R_Pick3");
                            System.Threading.Thread.Sleep(2000);
                        }
                    }
                    else if (index.Equals(4))
                    {
                        SetPickObj("R3");
                        if (values[2].Equals("선택확정"))
                        {
                            KAScene.GetObject("B_Pick_Color_Box3").SetVisible(1);
                            Console.WriteLine("B_Pick3");
                            System.Threading.Thread.Sleep(2000);
                        }
                    }
                    else if (index.Equals(5))
                    {
                        SetPickObj("B3");
                        if (values[2].Equals("선택확정"))
                        {
                            KAScene.GetObject("B_Ban_Color_Box4").SetVisible(1);
                            Console.WriteLine("B_Ban4");
                            System.Threading.Thread.Sleep(2000);
                        }
                    }
                    else if (index.Equals(6))
                    {
                        SetPickObj("B4");
                        if (values[2].Equals("선택확정"))
                        {
                            KAScene.GetObject("R_Pick_Color_Box4").SetVisible(1);
                            Console.WriteLine("R_Pick4");
                            System.Threading.Thread.Sleep(2000);
                        }
                    }
                    else if (index.Equals(7))
                    {
                        SetPickObj("R4");
                        if (values[2].Equals("선택확정"))
                        {
                            KAScene.GetObject("R_Pick_Color_Box5").SetVisible(1);
                            Console.WriteLine("R_Pick5");
                            System.Threading.Thread.Sleep(2000);
                        }
                    }
                    else if (index.Equals(8))
                    {
                        SetPickObj("R5");
                        if (values[2].Equals("선택확정"))
                        {
                            KAScene.GetObject("B_Pick_Color_Box5").SetVisible(1);
                            Console.WriteLine("B_Pick5");
                            System.Threading.Thread.Sleep(2000);
                        }
                    }
                    else if (index.Equals(9))
                    {
                        SetPickObj("B5");
                        System.Threading.Thread.Sleep(2000);
                    }
                }
            }
            else //블루 시작시
            {
                if (isBan)
                {
                    void setBanObj(string tag)
                    {
                        LoadScene("30SecTimer");
                        Prepare(2);
                        Play(2);

                        KAScene = KAScenePlayer.GetPlayingScene(1);
                        KAEngine.BeginTransaction();
                        KAScene.GetObject(tag[0] + "_Ban" + tag[1]).SetValue(values[0]);
                        KAScene.GetObject(tag[0] + "_Ban_Color_Box" + tag[1]).SetVisible(0);
                        KAEngine.EndTransaction();

                        KAScenePlayer.Play(1);
                    }

                    if (index.Equals(0))
                    {
                        Console.WriteLine("B_Ban1");
                        LoadScene("30SecTimer");
                        Prepare(2);
                        Play(2);
                        System.Threading.Thread.Sleep(2000);
                    }
                    else if (index.Equals(1))
                    {
                        setBanObj("B1");
                        KAScene.GetObject("R_Ban_Color_Box1").SetVisible(1);
                        Console.WriteLine("R_Ban1");
                        System.Threading.Thread.Sleep(2000);
                    }
                    else if (index.Equals(2))
                    {
                        setBanObj("R1");
                        KAScene.GetObject("B_Ban_Color_Box2").SetVisible(1);
                        Console.WriteLine("B_Ban2");
                        System.Threading.Thread.Sleep(2000);
                    }
                    else if (index.Equals(3))
                    {
                        setBanObj("B2");
                        KAScene.GetObject("R_Ban_Color_Box2").SetVisible(1);
                        Console.WriteLine("R_Ban2");
                        System.Threading.Thread.Sleep(2000);
                    }
                    else if (index.Equals(4))
                    {
                        setBanObj("R2");
                        KAScene.GetObject("B_Ban_Color_Box3").SetVisible(1);
                        Console.WriteLine("B_Ban3");
                        System.Threading.Thread.Sleep(2000);
                    }
                    else if (index.Equals(5))
                    {
                        setBanObj("B3");
                        KAScene.GetObject("R_Ban_Color_Box3").SetVisible(1);
                        Console.WriteLine("R_Ban3");
                        System.Threading.Thread.Sleep(2000);
                    }
                    else if (index.Equals(6))
                    {
                        setBanObj("R3");
                        KAScene.GetObject("B_Pick_Color_Box1").SetVisible(1);
                        Console.WriteLine("B_Pick1");
                        System.Threading.Thread.Sleep(2000);

                    }
                    else if (index.Equals(7))
                    {
                        setBanObj("R4");
                        KAScene.GetObject("B_Ban_Color_Box4").SetVisible(1);
                        Console.WriteLine("B_Ban4");
                        System.Threading.Thread.Sleep(2000);
                    }
                    else if (index.Equals(8))
                    {
                        setBanObj("B4");
                        KAScene.GetObject("R_Ban_Color_Box5").SetVisible(1);
                        Console.WriteLine("R_Ban5");
                        System.Threading.Thread.Sleep(2000);
                    }
                    else if (index.Equals(9))
                    {
                        setBanObj("R5");
                        KAScene.GetObject("B_Ban_Color_Box5").SetVisible(1);
                        Console.WriteLine("B_Ban5");
                        System.Threading.Thread.Sleep(2000);
                    }
                    else if (index.Equals(10))
                    {
                        setBanObj("B5");
                        KAScene.GetObject("R_Pick_Color_Box4").SetVisible(1);
                        Console.WriteLine("R_Pick4");
                        System.Threading.Thread.Sleep(2000);
                    }

                }
                else
                {
                    void SetPickObj(string tag)
                    {

                        if (values[2].Equals("고르는중"))
                        {
                            KAScene = KAScenePlayer.GetPlayingScene(1);
                            KAEngine.BeginTransaction();

                            SetVisible(tag[0] + "_Pick_Ready" + tag[1], true);
                            SetValue(tag[0] + "_Pick_Ready" + tag[1], values[0]);

                            Console.WriteLine(tag[0] + " Pick" + tag[1] + "_1");
                            KAEngine.EndTransaction();
                        }


                        if (values[2].Equals("선택확정"))
                        {
                            LoadScene(tag == "R5" ? "60SecTimer" : "30SecTimer");
                            Prepare(2);
                            Play(2);

                            KAScene = KAScenePlayer.GetPlayingScene(1);
                            KAEngine.BeginTransaction();


                            SetVisible(tag[0] + "_Pick_Ready" + tag[1], true);
                            SetValue(tag[0] + "_Pick_Ready" + tag[1], values[0]);
                            KAScene.GetObject(tag[0] + "_Pick_Color_Box" + tag[1]).SetVisible(0);
                            SetValue(tag[0] + "_Pick" + tag[1], values[0]);
                            //KAScene.GetObject(tag).SetVisible(0);
                            //KAScene.GetObject(tag[0] + "_Pick" + tag[1]).SetValue(values[0]); 
                            Console.WriteLine(tag[0] + " Pick" + tag[1] + "_1");



                            KAEngine.EndTransaction();
                            KAScenePlayer.Play(1);
                        }



                        //if (values[2].Equals("선택확정")) System.Threading.Thread.Sleep(2000);
                    }

                    if (index.Equals(0))
                    {
                        SetPickObj("B1");
                        if (values[2].Equals("선택확정"))
                        {
                            KAScene.GetObject("R_Pick_Color_Box1").SetVisible(1);
                            Console.WriteLine("R_Pick1");
                            System.Threading.Thread.Sleep(2000);
                        }
                    }
                    else if (index.Equals(1))
                    {
                        SetPickObj("R1");
                        if (values[2].Equals("선택확정"))
                        {
                            KAScene.GetObject("R_Pick_Color_Box2").SetVisible(1);
                            Console.WriteLine("R_Pick2");
                            System.Threading.Thread.Sleep(2000);
                        }
                    }
                    else if (index.Equals(2))
                    {
                        SetPickObj("R2");
                        if (values[2].Equals("선택확정"))
                        {
                            KAScene.GetObject("B_Pick_Color_Box2").SetVisible(1);
                            Console.WriteLine("B_Pick2");
                            System.Threading.Thread.Sleep(2000);
                        }
                    }
                    else if (index.Equals(3))
                    {
                        SetPickObj("B2");
                        if (values[2].Equals("선택확정"))
                        {
                            KAScene.GetObject("B_Pick_Color_Box3").SetVisible(1);
                            Console.WriteLine("B_Pick3");
                            System.Threading.Thread.Sleep(2000);
                        }
                    }
                    else if (index.Equals(4))
                    {
                        SetPickObj("B3");
                        if (values[2].Equals("선택확정"))
                        {
                            KAScene.GetObject("R_Pick_Color_Box3").SetVisible(1);
                            Console.WriteLine("R_Pick3");
                            System.Threading.Thread.Sleep(2000);
                        }
                    }
                    else if (index.Equals(5))
                    {
                        SetPickObj("R3");
                        if (values[2].Equals("선택확정"))
                        {
                            KAScene.GetObject("R_Ban_Color_Box4").SetVisible(1);
                            Console.WriteLine("R_Ban4");
                            System.Threading.Thread.Sleep(2000);
                        }
                    }
                    else if (index.Equals(6))
                    {
                        SetPickObj("R4");
                        if (values[2].Equals("선택확정"))
                        {
                            KAScene.GetObject("B_Pick_Color_Box4").SetVisible(1);
                            Console.WriteLine("B_Pick4");
                            System.Threading.Thread.Sleep(2000);
                        }
                    }
                    else if (index.Equals(7))
                    {
                        SetPickObj("B4");
                        if (values[2].Equals("선택확정"))
                        {
                            KAScene.GetObject("B_Pick_Color_Box5").SetVisible(1);
                            Console.WriteLine("B_Pick5");
                            System.Threading.Thread.Sleep(2000);
                        }
                    }
                    else if (index.Equals(8))
                    {
                        SetPickObj("B5");
                        if (values[2].Equals("선택확정"))
                        {
                            KAScene.GetObject("R_Pick_Color_Box5").SetVisible(1);
                            Console.WriteLine("R_Pick5");
                            System.Threading.Thread.Sleep(2000);
                        }
                    }
                    else if (index.Equals(9))
                    {
                        SetPickObj("R5");
                        System.Threading.Thread.Sleep(2000);
                    }
                }
            }
            
        }


        public void DisplayBanPick_old(string[] titles, string[] teams, DataControl dc, string[] scores)
        {
            LoadScene(sceneNameBanPick_old);

            isBanPickStart = false;
            timer = new Timer();
            timer.Interval = 1000;
            timer.Tick += new EventHandler(timer_Tick);

            bScore = scores[0];
            rScore = scores[1];
            bScoreAll = scores[2];
            rScoreAll = scores[3];

            for (int i = 0; i < 5; i++)
            {
                KAScene.GetObject("B_Pick_Player_Name" + (i + 1)).SetValue(dc.BlueLiner.GetLiner(i).Name);
                KAScene.GetObject("R_Pick_Player_Name" + (i + 1)).SetValue(dc.RedLiner.GetLiner(i).Name);
            }
            

            KAScene.GetObject("B_Team_Logo").SetValue(RES_FOLDER_PATH + "Team Logo(1080x1080)\\" + teams[0] + ".png");
            KAScene.GetObject("R_Team_Logo").SetValue(RES_FOLDER_PATH + "Team Logo(1080x1080)\\" + teams[1] + ".png");

            KAScene.GetObject("B_Team_Name").SetValue(teams[0]);
            KAScene.GetObject("R_Team_Name").SetValue(teams[1]);

            //KAScene.GetObject("B_Score").SetValue(bScore);
            //KAScene.GetObject("R_Score").SetValue(rScore);

            KAScene.GetObject("Timer").SetValue("27");
            KAScene.GetObject("Match").SetValue(titles[0]);
            KAScene.GetObject("Patch").SetValue(titles[1]);
            KAScene.GetObject("Version").SetValue(titles[2]);

            KAScene.GetObject("BScore").SetValue(bScore);
            KAScene.GetObject("RScore").SetValue(rScore);
            KAScene.GetObject("BScoreAll").SetValue(bScoreAll);
            KAScene.GetObject("RScoreAll").SetValue(rScoreAll);

            //트리거--- 홀드 지정
            for (int i = 1; i <= 5; i++)
            {
                KAScene.AddPauseByName("B_Ban" + i.ToString(), 1500, 0, 0);
                KAScene.AddPauseByName("R_Ban" + i.ToString(), 1500, 0, 0);

                KAScene.AddPauseByName("B_Pick" + i.ToString(), 1500, 0, 0);
                KAScene.AddPauseByName("R_Pick" + i.ToString(), 1500, 0, 0);

                KAScene.AddPauseByName("B Pick" + i.ToString() + "_1", 60, 0, 0);
                KAScene.AddPauseByName("R Pick" + i.ToString() + "_1", 60, 0, 0);

            }
            isDisplayBanPick = true;

            KAScene.GetObject("BScore").SetVisible(1);
            KAScene.GetObject("RScore").SetVisible(1);
            KAScene.GetObject("BScore").SetValue(bScore);
            KAScene.GetObject("RScore").SetValue(rScore);
            KAScene.GetObject("BScoreAll").SetValue(bScoreAll);
            KAScene.GetObject("RScoreAll").SetValue(rScoreAll);
 

            Prepare(mainLayer);
            Play(mainLayer);

            PickTriggerShown = new bool[] { false, false, false, false, false, false, false, false, false, false, false };
        }
        bool[] PickTriggerShown;

        public void DisplayBanPickStart_old(int index, string[] values, bool isBan)
        { 
            string strs = "";
            if (values != null)
            {
                foreach (var v in values)
                {
                    strs += " " + v;
                }
            }
            Console.WriteLine("BanPick 시작" + "Index : " + index + "string : " + strs + "IsBan : " + isBan);

            if (isBan)
            {
                void setBanObj(string tag)
                {

                    KAScene.GetObject(tag).SetVisible(1);
                    KAScene.GetObject(tag[0] + "_Ban" + tag[1]).SetValue(values[0]); 
                    KAScenePlayer.TriggerByName(1, tag[0] + " Ban" + tag[1] + "_1");
                    System.Threading.Thread.Sleep(1500);
                    Console.WriteLine(tag[0] + " Ban" + tag[1] + "_1");
                    Console.WriteLine("Sleep 1500");
                    TimerTime = 27;
                    KAScene.GetObject("Timer").SetValue("" + string.Format("{0:00}", TimerTime));
                    timer.Start();
                }

                if (index.Equals(0))
                {
                    KAScenePlayer.TriggerByName(1, "B_Ban1");
                    Console.WriteLine("B_Ban1");
                    timer.Start();
                }
                else if (index.Equals(1))
                {
                    setBanObj("B1");
                    KAScenePlayer.TriggerByName(1, "R_Ban1");
                    Console.WriteLine("R_Ban1");
                }
                else if (index.Equals(2))
                {
                    setBanObj("R1");
                    KAScenePlayer.TriggerByName(1, "B_Ban2");
                    Console.WriteLine("B_Ban2");
                }
                else if (index.Equals(3))
                {
                    setBanObj("B2");
                    KAScenePlayer.TriggerByName(1, "R_Ban2");
                    Console.WriteLine("R_Ban2");
                }
                else if (index.Equals(4))
                {
                    setBanObj("R2");
                    KAScenePlayer.TriggerByName(1, "B_Ban3");
                    Console.WriteLine("B_Ban3");
                }
                else if (index.Equals(5))
                {
                    setBanObj("B3");
                    KAScenePlayer.TriggerByName(1, "R_Ban3");
                    Console.WriteLine("R_Ban3");
                }
                else if (index.Equals(6))
                {
                    setBanObj("R3"); 
                    KAScenePlayer.TriggerByName(1, "LineUp");
                    Console.WriteLine("LineUp");

                    System.Threading.Thread.Sleep(3000);

                    KAScenePlayer.TriggerByName(1, "B_Pick1");
                    Console.WriteLine("B_Pick1");
                }
                else if (index.Equals(7))
                {
                    setBanObj("R4");
                    KAScenePlayer.TriggerByName(1, "B_Ban4");
                    Console.WriteLine("B_Ban4");
                }
                else if (index.Equals(8))
                {
                    setBanObj("B4");
                    KAScenePlayer.TriggerByName(1, "R_Ban5");
                    Console.WriteLine("R_Ban5");
                }
                else if (index.Equals(9))
                {
                    setBanObj("R5");
                    KAScenePlayer.TriggerByName(1, "B_Ban5");
                    Console.WriteLine("B_Ban5");
                }
                else if (index.Equals(10))
                {
                    setBanObj("B5");
                    System.Threading.Thread.Sleep(1000);
                    KAScenePlayer.TriggerByName(1, "R_Pick4");
                    Console.WriteLine("R_Pick4");
                }

            } 
            else
            {


                void SetPickObj(string tag)
                {
                    if (values[2].Equals("고르는중"))
                    {
                        KAScene.GetObject(tag).SetVisible(1);
                        KAScene.GetObject(tag[0] + "_Pick" + tag[1]).SetValue(values[0]);
                        KAScene.GetObject(tag[0] + "_Pick_Champion_Name" + tag[1]).SetValue(GetChampName(values[1]));

                        if (!PickTriggerShown[index])
                        {
                            KAScenePlayer.TriggerByName(1, tag[0] + " Pick" + tag[1] + "_1");

                            System.Threading.Thread.Sleep(2000);
                            PickTriggerShown[index] = true;
                        }

                        Console.WriteLine(tag[0] + " Pick" + tag[1] + "_1");
                    }


                    if (values[2].Equals("선택확정"))
                    {
                        if (timer.Enabled) timer.Stop();
                        KAScene.GetObject(tag).SetVisible(0);
                        KAScene.GetObject(tag[0] + "_Pick" + tag[1]).SetValue(values[0]);
                        KAScene.GetObject(tag[0] + "_Pick_Champion_Name" + tag[1]).SetValue(GetChampName(values[1]));
                        if (!PickTriggerShown[index])
                        {                          
                            KAScenePlayer.TriggerByName(1, tag[0] + " Pick" + tag[1] + "_1");
                            PickTriggerShown[index] = true;
                            System.Threading.Thread.Sleep(2000);
                            
                        }
                       
                        KAScenePlayer.Resume(1);
                        Console.WriteLine(tag[0] + " Pick" + tag[1] + "_1");
                        System.Threading.Thread.Sleep(2000);

                        TimerTime = 26;
                        KAScene.GetObject("Timer").SetValue("" + string.Format("{0:00}", TimerTime));
                        timer.Start();
                    }
                }

                if (index.Equals(0))
                {
                    SetPickObj("B1");
                    if (values[2].Equals("선택확정"))
                    {
                        KAScenePlayer.TriggerByName(1, "R_Pick1");
                        Console.WriteLine("R_Pick1");
                    }
                }
                else if (index.Equals(1))
                {
                    SetPickObj("R1");
                    if (values[2].Equals("선택확정"))
                    {
                        KAScenePlayer.TriggerByName(1, "R_Pick2");
                        Console.WriteLine("R_Pick2");
                    }
                }
                else if (index.Equals(2))
                {
                    SetPickObj("R2");
                    if (values[2].Equals("선택확정"))
                    {
                        KAScenePlayer.TriggerByName(1, "B_Pick2");
                        Console.WriteLine("B_Pick2");
                    }
                }
                else if (index.Equals(3))
                {
                    SetPickObj("B2");
                    if (values[2].Equals("선택확정"))
                    {
                        KAScenePlayer.TriggerByName(1, "B_Pick3");
                        Console.WriteLine("B_Pick3");
                    }
                }
                else if (index.Equals(4))
                {
                    SetPickObj("B3");
                    if (values[2].Equals("선택확정"))
                    {
                        KAScenePlayer.TriggerByName(1, "R_Pick3");
                        Console.WriteLine("R_Pick3");
                    }
                }
                else if (index.Equals(5))
                {
                    SetPickObj("R3");
                    if (values[2].Equals("선택확정"))
                    {
                        KAScenePlayer.TriggerByName(1, "R_Ban4");
                        Console.WriteLine("R_Ban4");
                    }
                }
                else if (index.Equals(6))
                {
                    SetPickObj("R4");
                    if (values[2].Equals("선택확정"))
                    {
                        KAScenePlayer.TriggerByName(1, "B_Pick4");
                        Console.WriteLine("B_Pick4");
                    }
                }
                else if (index.Equals(7))
                {
                    SetPickObj("B4");
                    if (values[2].Equals("선택확정"))
                    {
                        KAScenePlayer.TriggerByName(1, "B_Pick5");
                        Console.WriteLine("B_Pick5");
                    }
                }
                else if (index.Equals(8))
                {
                    SetPickObj("B5");
                    if (values[2].Equals("선택확정"))
                    {
                        KAScenePlayer.TriggerByName(1, "R_Pick5");
                        Console.WriteLine("R_Pick5");
                    }
                }
                else if (index.Equals(9))
                {
                    SetPickObj("R5");
                    if (values[2].Equals("선택확정"))
                    { 
                        if (timer.Enabled) timer.Stop();
                        TimerTime = 60;
                        KAScene.GetObject("Timer").SetValue("" + string.Format("{0:00}", TimerTime));
                        timer.Start();
                    }
                }
            }

            KAScene.GetObject("BScore").SetVisible(1);
            KAScene.GetObject("RScore").SetVisible(1);
            KAScene.GetObject("BScore").SetValue(bScore);
            KAScene.GetObject("RScore").SetValue(rScore);

        }

        public void DisplaySwapPhase(string[] titles, string[] teams, DataControl dc)
        {
            KAScene = KAScenePlayer.GetPlayingScene(1);
            KAEngine.BeginTransaction();

            string getChampsPathBanPick(string fileName) =>   RES_FOLDER_PATH + @"Champs(158x245)\" + fileName + "_158245.png"; 

            for (int i = 1; i <= 5; i++)
            {
                Liner liner = dc.BlueLiner.GetLiner(i - 1);
                KAScene.GetObject("B_Pick" + i).SetValue(getChampsPathBanPick(liner.champ)); 


                liner = dc.RedLiner.GetLiner(i - 1);
                KAScene.GetObject("R_Pick" + i).SetValue(getChampsPathBanPick(liner.champ)); 
            }

            KAEngine.EndTransaction(); 
        }


        public void DisplaySwapPhase_old(string[] titles, string[] teams, DataControl dc)
        {
            LoadScene(sceneNameBanPickManual);



            KAScene.GetObject("B_Team_Logo").SetValue(RES_FOLDER_PATH + "Team Logo(1080x1080)\\" + teams[0] + ".png");
            KAScene.GetObject("R_Team_Logo").SetValue(RES_FOLDER_PATH + "Team Logo(1080x1080)\\" + teams[1] + ".png");

            KAScene.GetObject("B_Team_Name").SetValue(teams[0]);
            KAScene.GetObject("R_Team_Name").SetValue(teams[1]);
             
            KAScene.GetObject("Match").SetValue(titles[0]);
            KAScene.GetObject("Patch").SetValue(titles[1]);
            KAScene.GetObject("Version").SetValue(titles[2]);

            KAScene.GetObject("Timer").SetValue("" + string.Format("{0:00}", TimerTime));
            KAScene.GetObject("BScore").SetValue(bScore);
            KAScene.GetObject("RScore").SetValue(rScore);
            KAScene.GetObject("BScoreAll").SetValue(bScoreAll);
            KAScene.GetObject("RScoreAll").SetValue(rScoreAll);


            string getChampsPathBanPick(string fileName, bool isBlue)
            {
                if (isBlue) return RES_FOLDER_PATH + @"Champs(520x370)\" + fileName + "_L.png";
                else return RES_FOLDER_PATH + @"Champs(520x370)\" + fileName + "_R.png";
            }
            string getChampsPath(string fileName) => RES_FOLDER_PATH + @"Champs(140x140)\" + fileName + "_140140.png";

            for (int i = 1; i <= 5; i++)
            {
                Liner liner = dc.BlueLiner.GetLiner(i - 1);
                KAScene.GetObject("B_Pick" + i).SetValue(getChampsPathBanPick(liner.champ, true));
                KAScene.GetObject("B_Pick_Champion_Name" + i).SetValue(GetChampName(liner.champ.ToUpper()));
                KAScene.GetObject("B_Pick_Player_Name" + i).SetValue(liner.Name);
                KAScene.GetObject("B_Ban" + i).SetValue(getChampsPath(liner.ban));


                liner = dc.RedLiner.GetLiner(i - 1);
                KAScene.GetObject("R_Pick" + i).SetValue(getChampsPathBanPick(liner.champ, false));
                KAScene.GetObject("R_Pick_Champion_Name" + i).SetValue(GetChampName(liner.champ.ToUpper()));
                KAScene.GetObject("R_Pick_Player_Name" + i).SetValue(liner.Name);
                KAScene.GetObject("R_Ban" + i).SetValue(getChampsPath(liner.ban));

            }

            Prepare(mainLayer);
            Play(mainLayer);
        }

        #endregion


        #region 라인업

        public void DisplayLineUp(string[] titles, Liners linerBlue, Liners linerRed)
        {
            LoadScene(sceneNameLineUp);


            KAScene.GetObject("Group").SetValue(titles[0]);
            KAScene.GetObject("Match").SetValue(titles[1]);
            KAScene.GetObject("Version").SetValue(titles[2]);

            KAScene.GetObject("BScore").SetValue(bScore);
            KAScene.GetObject("RScore").SetValue(rScore);
            KAScene.GetObject("BScoreAll").SetValue(bScoreAll);
            KAScene.GetObject("RScoreAll").SetValue(rScoreAll);

            KAScene.GetObject("B_Team_Name").SetValue(linerBlue.TeamName);
            KAScene.GetObject("B_Team_Logo").SetValue(RES_FOLDER_PATH + "Team Logo(1080x1080)\\" + linerBlue.TeamName + ".png");             

            KAScene.GetObject("R_Team_Name").SetValue(linerRed.TeamName);
            KAScene.GetObject("R_Team_Logo").SetValue(RES_FOLDER_PATH + "Team Logo(1080x1080)\\" + linerRed.TeamName + ".png");

            string getChampsPathLineUp(string fileName, bool isBlue)
            {
                if (isBlue) return RES_FOLDER_PATH + @"Champs(620x130)\" + fileName + "_L.png";
                else return RES_FOLDER_PATH + @"Champs(620x130)\" + fileName + "_R.png";
            }

            for (int i = 1; i <= 5; i++)
            {
                Liner blue = linerBlue.GetLiner(i - 1);
                Liner red = linerRed.GetLiner(i - 1);

                KAScene.GetObject("B_Champion" + i).SetValue(getChampsPathLineUp(blue.champ, false));       //챔프이미지
                KAScene.GetObject("B_Champion_Name" + i).SetValue(GetChampName(blue.champ) ); //챔프이름
                KAScene.GetObject("B_Image_Player" + i).SetValue(_designPath + "TeamLogo\\LineUp\\" + linerBlue.TeamName + "\\" + blue.Name + ".png"); //선수사진                                                                                                                                                                      
                KAScene.GetObject("B_Player_Name" + i.ToString()).SetValue(blue.Name); //선수이름

                KAScene.GetObject("R_Champion" + i).SetValue(getChampsPathLineUp(red.champ, true));       //챔프이미지
                KAScene.GetObject("R_Champion_Name" + i).SetValue(GetChampName(red.champ)); //챔프이름
                KAScene.GetObject("R_Image_Player" + i).SetValue(_designPath + "TeamLogo\\LineUp\\" + linerRed.TeamName + "\\" + red.Name + ".png"); //선수사진                                                                                                                                                                      
                KAScene.GetObject("R_Player_Name" + i.ToString()).SetValue(red.Name); //선수이름


            }


            Prepare(mainLayer);
            Play(mainLayer);
        }


        public void DisplayLineChamp()
        {
            LoadScene(sceneNameLineUp);



            Prepare(mainLayer);
            Play(mainLayer);
        }

        #endregion


        #region 상단스코어판
        public bool isScoreDisplaying = false;
        public void DisplayScore(string[] values, string[] values2)
        {

           

            if (isScoreDisplaying)
            {
                KAScene = KAScenePlayer.GetPlayingScene(layoutScore);

                eKSceneEffectType etype = eKSceneEffectType.SCENE_CHANGE_EFFECT_NONE;
                KAScene.SetSceneEffectType(1, etype, 0); 

                KAEngine.BeginTransaction();

                int BTeamScore = Convert.ToInt16(values[0]);
                int RTeamScore = Convert.ToInt16(values[2]);

                
                for (int i = 1; i < 4; i++)
                {
                    SetVisible("R_Score" + i, false);
                    SetVisible("B_Score" + i, false);

                    if (BTeamScore >= i) SetVisible("B_Score" + i, true);
                    if (RTeamScore >= i) SetVisible("R_Score" + i, true);
                }

                //SetValue("B_Team_Score", values[0]);
                //SetValue("R_Team_Score", values[2]);

                SetValue("B_Team_Name", values[1]);                
                SetValue("R_Team_Name", values[3]);

                KAScene.GetObject("B_Team_Logo").SetValue(RES_FOLDER_PATH + "Team Logo(1080x1080)\\" + values[1] + ".png");
                KAScene.GetObject("R_Team_Logo").SetValue(RES_FOLDER_PATH + "Team Logo(1080x1080)\\" + values[3] + ".png");

                KAScene.GetObject("BScore").SetValue(values[0]);
                KAScene.GetObject("RScore").SetValue(values[2]);
                KAScene.GetObject("BScoreAll").SetValue(values[4]);
                KAScene.GetObject("RScoreAll").SetValue(values[5]);

                KAScene.GetObject("R_EpicMonster").SetValue(values2[0]);
                KAScene.GetObject("R_Turret").SetValue(values2[1]);
                KAScene.GetObject("R_FirstBlood").SetValue(values2[2]);
                KAScene.GetObject("B_EpicMonster").SetValue(values2[3]);
                KAScene.GetObject("B_Turret").SetValue(values2[4]);
                KAScene.GetObject("B_FirstBlood").SetValue(values2[5]);

                KAScene.QueryVariables();
                KAEngine.EndTransaction();  
            }
            else
            { 
                LoadScene(sceneNameScore);

                int BTeamScore = Convert.ToInt16(values[0]);
                int RTeamScore = Convert.ToInt16(values[2]);


                for (int i = 1; i < 4; i++)
                {
                    SetVisible("R_Score" + i, false);
                    SetVisible("B_Score" + i, false);

                    if (BTeamScore >= i) SetVisible("B_Score" + i, true);
                    if (RTeamScore >= i) SetVisible("R_Score" + i, true);
                }

                //SetValue("B_Team_Score", values[0]);
                //SetValue("R_Team_Score", values[2]);


                SetValue("B_Team_Name", values[1]);
                SetValue("R_Team_Name", values[3]);

                KAScene.GetObject("B_Team_Logo").SetValue(RES_FOLDER_PATH + "Team Logo(1080x1080)\\" + values[1] + ".png");
                KAScene.GetObject("R_Team_Logo").SetValue(RES_FOLDER_PATH + "Team Logo(1080x1080)\\" + values[3] + ".png");

                KAScene.GetObject("BScore").SetValue(values[0]);
                KAScene.GetObject("RScore").SetValue(values[2]);
                KAScene.GetObject("BScoreAll").SetValue(values[4]);
                KAScene.GetObject("RScoreAll").SetValue(values[5]);

                KAScene.GetObject("R_EpicMonster").SetValue(values2[0]);
                KAScene.GetObject("R_Turret").SetValue(values2[1]);
                KAScene.GetObject("R_FirstBlood").SetValue(values2[2]);
                KAScene.GetObject("B_EpicMonster").SetValue(values2[3]);
                KAScene.GetObject("B_Turret").SetValue(values2[4]);
                KAScene.GetObject("B_FirstBlood").SetValue(values2[5]);

                Prepare(layoutScore);
                Play(layoutScore);

                isScoreDisplaying = true;
            }
        }

        public void OutScore()
        {
            Out(layoutScore);
            isScoreDisplaying = false;
        }

        #endregion


        #region 용 획득판 

        public bool[] BQuest = new bool[5] { false, false, false, false, false };
        public bool[] RQuest = new bool[5] { false, false, false, false, false };

        public void DisplayDragon()
        {
            LoadScene(sceneNameDragon);             
            KAEngine.BeginTransaction();                        

            KAScene.GetObject("B_Image1").SetValue(bbufD[0]);
            KAScene.GetObject("B_Image2").SetValue(bbufD[1]);
            KAScene.GetObject("B_Image3").SetValue(bbufD[2]);
            KAScene.GetObject("B_Image4").SetValue(bbufD[3]);
            KAScene.GetObject("B_Image5").SetValue(bbufD[4]);
            KAScene.GetObject("B_Image6").SetValue(bbufD[5]);

            KAScene.GetObject("R_Image1").SetValue(rbufD[0]);
            KAScene.GetObject("R_Image2").SetValue(rbufD[1]);
            KAScene.GetObject("R_Image3").SetValue(rbufD[2]);
            KAScene.GetObject("R_Image4").SetValue(rbufD[3]);
            KAScene.GetObject("R_Image5").SetValue(rbufD[4]);
            KAScene.GetObject("R_Image6").SetValue(rbufD[5]);

            KAScene.GetObject("B_Atakhan1").SetValue(bAtakhan);
            KAScene.GetObject("R_Atakhan1").SetValue(rAtakhan);

            //달성이미지
            string getLinePath(string pos, bool isQuest)
            {
                string done = isQuest ? "_COM" : "_NONE";
                return RES_FOLDER_PATH + @"RoleQuest\" + pos + done + ".png";
            }
            KAScene.GetObject("B_Quest_1").SetValue(getLinePath("TOP", BQuest[0]));
            KAScene.GetObject("B_Quest_2").SetValue(getLinePath("JGL", BQuest[1]));
            KAScene.GetObject("B_Quest_3").SetValue(getLinePath("MID", BQuest[2]));
            KAScene.GetObject("B_Quest_4").SetValue(getLinePath("BOT", BQuest[3]));
            KAScene.GetObject("B_Quest_5").SetValue(getLinePath("SPT", BQuest[4]));

            KAScene.GetObject("R_Quest_1").SetValue(getLinePath("TOP", RQuest[0]));
            KAScene.GetObject("R_Quest_2").SetValue(getLinePath("JGL", RQuest[1]));
            KAScene.GetObject("R_Quest_3").SetValue(getLinePath("MID", RQuest[2]));
            KAScene.GetObject("R_Quest_4").SetValue(getLinePath("BOT", RQuest[3]));
            KAScene.GetObject("R_Quest_5").SetValue(getLinePath("SPT", RQuest[4]));


            KAScene.QueryVariables();
            KAEngine.EndTransaction();

            Prepare(layoutDragon);
            Play(layoutDragon);

            isDisplayDragon = true;
        }

        public void OutDragon()
        {
            isDisplayDragon = false;
            Out(layoutDragon);
            
        }

        #endregion


        #region 용 타이머

        string BeforeDragon = "";
        public void DisplayDragonTime(bool isFirst, string dragonTime, string dragon)
        {
            if (isFirst)
            {
                LoadScene(sceneNameDragonTimer);
                isDisplayDragonTimer = true;
                BeforeDragon = "";

                eKSceneEffectType etype = eKSceneEffectType.SCENE_CHANGE_EFFECT_FADE;
                KAScene.SetSceneEffectType(1, etype, FadeInSec);
            }
            else
            {
                KAScene = KAScenePlayer.GetPlayingScene(layoutDragonTimer);

                eKSceneEffectType etype = eKSceneEffectType.SCENE_CHANGE_EFFECT_NONE;
                KAScene.SetSceneEffectType(1, etype, 0);
            }


            KAEngine.BeginTransaction();
            if (!BeforeDragon.Equals(dragon))
            {
                //KAScene.GetObject("Name_Dragon").SetValue(dragon);
                KAScene.GetObject("Name_Dragon").SetValue(DragonName(dragon));
                KAScene.GetObject("Image_Dragon").SetValue(resPath(dragon));
                BeforeDragon = dragon;
            }
            if (dragonTime.Substring(2, 1) == ":" && dragonTime.Substring(0, 1) == "0") dragonTime = dragonTime.Substring(1);
            KAScene.GetObject("Timer_Dragon").SetValue(dragonTime);

            KAEngine.EndTransaction();

            if (isFirst)
            {
                Prepare(layoutDragonTimer);
                Play(layoutDragonTimer); 
            } 
        }

        public void OutDragonTime()
        {
            isDisplayDragonTimer = false;
            Out(layoutDragonTimer);
        }

        public string DragonName(string dragon)
        {
            if (dragon.Equals("Wind")) return "Cloud";
            else if (dragon.Equals("Earth")) return "Mountain";

            return dragon;
        }

        #endregion


        #region 장로 타이머

        public void DisplayElderTime(bool isFirst, string ElderTime, bool isBlue)
        {
            if (isFirst)
            {
                LoadScene(isBlue ? sceneNameElderTimerBlue : sceneNameElderTimerRed);
                eKSceneEffectType etype = eKSceneEffectType.SCENE_CHANGE_EFFECT_FADE;
                KAScene.SetSceneEffectType(1, etype, FadeInSec);
                isDisplayElderTimer = true;
            }
            else
            {
                KAScene = KAScenePlayer.GetPlayingScene(layoutElderTimer);
                eKSceneEffectType etype = eKSceneEffectType.SCENE_CHANGE_EFFECT_NONE;
                KAScene.SetSceneEffectType(1, etype, 0);
            }


            KAEngine.BeginTransaction();
            if (ElderTime.Substring(2, 1) == ":" && ElderTime.Substring(0, 1) == "0") ElderTime = ElderTime.Substring(1);
            KAScene.GetObject("Timer_Dragon").SetValue(ElderTime);

            KAEngine.EndTransaction();

            if (isFirst)
            {
                Prepare(layoutElderTimer);
                Play(layoutElderTimer);
            }

        }

        public void OutElderTime()
        {
            isDisplayElderTimer = false;
            Out(layoutElderTimer);
        }

        #endregion


        #region 타워골드

        public bool isTowerGoldDisplaying = false;
        public void DisplayGoldTower(List<string[]> strs)
        {

            if (isTowerGoldDisplaying)
            {
                KAScene = KAScenePlayer.GetPlayingScene(mainLayer);

                eKSceneEffectType etype = eKSceneEffectType.SCENE_CHANGE_EFFECT_NONE;
                KAScene.SetSceneEffectType(1, etype, 0);

                KAEngine.BeginTransaction();
                 

                foreach (string[] s in strs)
                {
                    SetValue(s[0], s[1]);
                }

                KAScene.QueryVariables();
                KAEngine.EndTransaction();
            }
            else
            {
                LoadScene(sceneNameTowerGold);

                foreach (string[] s in strs)
                {
                    SetValue(s[0], s[1]);
                }


                Prepare(mainLayer);
                Play(mainLayer);

                isTowerGoldDisplaying = true;
            }

            
        }

        #endregion

        #region 아타칸 타이머

        public void DisplayAtakanTime(bool isFirst, string atakanTime, int indexAtakhan)
        {

            if (isFirst)
            {
                LoadScene(sceneNameAtakanTimer);
                eKSceneEffectType etype = eKSceneEffectType.SCENE_CHANGE_EFFECT_FADE;
                KAScene.SetSceneEffectType(1, etype, FadeInSec);
                isDisplayAtakanTimer = true;
            }
            else
            {
                KAScene = KAScenePlayer.GetPlayingScene(layoutAtakanTimer);
                eKSceneEffectType etype = eKSceneEffectType.SCENE_CHANGE_EFFECT_NONE;
                KAScene.SetSceneEffectType(1, etype, 0);
            }


            KAEngine.BeginTransaction();
            if (atakanTime.Substring(2, 1) == ":" && atakanTime.Substring(0, 1) == "0") atakanTime = atakanTime.Substring(1);
            KAScene.GetObject("Timer_Atakhan").SetValue(atakanTime);
            /*
            if (indexAtakhan == 0) KAScene.GetObject("Atakhan").SetValue(Environment.CurrentDirectory + @"\Resource\MonsterRename\RuinousAtakhan.png");
            else KAScene.GetObject("Atakhan").SetValue(Environment.CurrentDirectory + @"\Resource\MonsterRename\VoraciousAtakhan.png");
            */
            //KAScene.QueryVariables(); 
            KAEngine.EndTransaction();

            if (isFirst)
            {
                Prepare(layoutAtakanTimer);
                Play(layoutAtakanTimer);
            } 
        }

        public void OutAtakanTime()
        {
            isDisplayAtakanTimer = false;
            Out(layoutAtakanTimer);
        }

        #endregion

        #region 전령 타이머

        public void DisplayHeraldTime(bool isFirst, string heraldTime)
        {

            if (isFirst)
            {
                LoadScene(sceneNameHeraldTimer);
                eKSceneEffectType etype = eKSceneEffectType.SCENE_CHANGE_EFFECT_FADE;
                KAScene.SetSceneEffectType(1, etype, FadeInSec);
                isDisplayHeraldTimer = true;
            }
            else
            {
                KAScene = KAScenePlayer.GetPlayingScene(layoutHeraldTimer);
                eKSceneEffectType etype = eKSceneEffectType.SCENE_CHANGE_EFFECT_NONE;
                KAScene.SetSceneEffectType(1, etype, 0);
            }


            KAEngine.BeginTransaction();
            if (heraldTime.Substring(2, 1) == ":" && heraldTime.Substring(0, 1) == "0") heraldTime = heraldTime.Substring(1);
            KAScene.GetObject("Timer_Herald").SetValue(heraldTime);
            //KAScene.QueryVariables(); 
            KAEngine.EndTransaction();

            if (isFirst)
            {
                Prepare(layoutHeraldTimer);
                Play(layoutHeraldTimer);
            }

        }

        public void OutHeraldTime()
        {
            isDisplayHeraldTimer = false;
            Out(layoutHeraldTimer);
        }

        #endregion


        #region 공허유충 타이머

        public void DisplayHordeTime(bool isFirst, string hordeTime)
        {

            if (isFirst)
            {
                LoadScene(sceneNameHordeTimer);
                eKSceneEffectType etype = eKSceneEffectType.SCENE_CHANGE_EFFECT_FADE;
                KAScene.SetSceneEffectType(1, etype, FadeInSec);
                isDisplayHordeTimer = true;
            }
            else
            {
                KAScene = KAScenePlayer.GetPlayingScene(layoutHordeTimer);
                eKSceneEffectType etype = eKSceneEffectType.SCENE_CHANGE_EFFECT_NONE;
                KAScene.SetSceneEffectType(1, etype, 0);
            }


            KAEngine.BeginTransaction();
            if (hordeTime.Substring(2, 1) == ":" && hordeTime.Substring(0, 1) == "0") hordeTime = hordeTime.Substring(1);
            KAScene.GetObject("Timer_Horde").SetValue(hordeTime);
            //KAScene.QueryVariables(); 
            KAEngine.EndTransaction();

            if (isFirst)
            {
                Prepare(layoutHordeTimer);
                Play(layoutHordeTimer);
            }

        }

        public void OutHordeTime()
        {
            isDisplayHordeTimer = false;
            Out(layoutHordeTimer);
        }

        #endregion


        #region 바론 타이머
        public void DisplayBaronTime(bool isFirst, string baronTime)
        {
            if (isFirst)
            {
                LoadScene(sceneNameBaronTimer);
                eKSceneEffectType etype = eKSceneEffectType.SCENE_CHANGE_EFFECT_FADE;
                KAScene.SetSceneEffectType(1, etype, FadeInSec);
                isDisplayBaronTimer = true;
            }
            else
            {
                KAScene = KAScenePlayer.GetPlayingScene(layoutBaronTimer);

                eKSceneEffectType etype = eKSceneEffectType.SCENE_CHANGE_EFFECT_NONE;
                KAScene.SetSceneEffectType(1, etype, 0);
            }


            KAEngine.BeginTransaction();
            if (baronTime.Substring(2, 1) == ":" && baronTime.Substring(0, 1) == "0") baronTime = baronTime.Substring(1);
            KAScene.GetObject("Timer_Baron").SetValue(baronTime);
            //KAScene.QueryVariables(); 
            KAEngine.EndTransaction();

            if (isFirst)
            {
                Prepare(layoutBaronTimer);
                Play(layoutBaronTimer);
            }

        }

        public void OutBaronTime()
        {
            isDisplayBaronTimer = false;
            Out(layoutBaronTimer);
        }

        #endregion


        #region 바론 버프


        #region 바론 파워플레이
        /*
        public void DisplayBaronPowerPlay(bool isFirst, string goldGap, bool isBlue)
        {
            if (isFirst)
            {
                string cutName = isBlue ? sceneNameBaronPowerPlayBlue : sceneNameBaronPowerPlayRed;

                LoadScene(cutName);
                eKSceneEffectType etype = eKSceneEffectType.SCENE_CHANGE_EFFECT_FADE;
                KAScene.SetSceneEffectType(1, etype, FadeInSec);
                isDisplayBaronPowerPlay = true;
            }
            else
            {
                KAScene = KAScenePlayer.GetPlayingScene(layoutBaronPowerPlay);
                eKSceneEffectType etype = eKSceneEffectType.SCENE_CHANGE_EFFECT_NONE;
                KAScene.SetSceneEffectType(1, etype, 0);
            }


            KAEngine.BeginTransaction();
            SetValue("pp", goldGap);
            //KAScene.QueryVariables(); 
            KAEngine.EndTransaction();


            if (isFirst)
            {
                Prepare(layoutBaronPowerPlay);
                Play(layoutBaronPowerPlay);
            }
        }

        public void OutBaronPowerPlay()
        {
            isDisplayBaronPowerPlay = false;
            Out(layoutBaronPowerPlay);
        }
        */
        #endregion
        public void DisplayBaronBuff(bool isFirst, string baronTime, bool isBlue, string goldGap)
        {
            if (isFirst)
            {
                string cutName = isBlue ? sceneNameBaronBuffBlue : sceneNameBaronBuffRed;

                LoadScene(cutName);
                eKSceneEffectType etype = eKSceneEffectType.SCENE_CHANGE_EFFECT_FADE;
                KAScene.SetSceneEffectType(1, etype, FadeInSec);
                isDisplayBraonBuff = true;
                isDisplayBaronPowerPlay = true;
            }
            else
            {
                KAScene = KAScenePlayer.GetPlayingScene(layoutBaronBuff);

                eKSceneEffectType etype = eKSceneEffectType.SCENE_CHANGE_EFFECT_NONE;
                KAScene.SetSceneEffectType(1, etype, 0);
            }


            KAEngine.BeginTransaction();
            //KAScene.GetObject("Timer_Baron").SetValue(baronTime);
            if (baronTime.Substring(2, 1) == ":" && baronTime.Substring(0, 1) == "0") baronTime = baronTime.Substring(1);
            SetValue("Timer_Baron", baronTime);
            SetValue("Title", "BARON BUFF");
            SetValue("pp", goldGap);
            //KAScene.QueryVariables(); 
            KAEngine.EndTransaction();

            /*
            string colorImg = isBlue ? imagePath("blue team light") : imagePath("red team light");
            SetValue("BaronBuff Timer_Team Color Effect", colorImg);
            */

            if (isFirst)
            {
                Prepare(layoutBaronBuff);
                Play(layoutBaronBuff);
            }

        }

        public void OutBaronBuff()
        {
            isDisplayBraonBuff = false;
            isDisplayBaronPowerPlay = false;
            Out(layoutBaronBuff);
        }

        #endregion



        #region 선수별 룬, 키스톤

        public void DisplayRunes(DataTable dt)
        {
           
            string getChampsPath(string fileName) => RES_FOLDER_PATH + @"Champs(140x140)\" + fileName + "_140140.png";
            string getRunePath(string fileName)
            {
                string returnValue = RES_FOLDER_PATH + @"Runes(140x140)\" + fileName + ".png";

                return returnValue.Replace("Legend:", "Legend");
            }

            LoadScene(sceneNameAllRunes);

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                string BR = i < 5 ? "B" : "R";
                int index = i < 5 ? i + 1 : i -4;

                //챔피언
                string champName = dt.Rows[i][2].ToString();
                SetValue(BR + "_Player_" + index, getChampsPath(champName));
                                 
                //룬
                for (int j = 5; j < 13; j++)
                {
                    int indexRow = j != 5 ? j : 4;

                    string rune = dt.Rows[i][indexRow].ToString();
                    string tag = BR + "_Player" + index + "_Rune_" + (j - 4);

                    if (j - 4 == 1) tag = BR + "_Player" + index + "_Rune_1";
                    else if (j - 4 == 2) tag = BR + "_Player" + index + "_Rune_6";
                    else if (j - 4 < 7) tag = BR + "_Player" + index + "_Rune_" + (j - 5);

                    SetValue(tag, getRunePath(rune));
                }
            } 

            Prepare(mainLayer);
            Play(mainLayer);
        }

        public void  DisplayKeyStone(DataTable dt, DataControl.Liners blue, DataControl.Liners red)
        {
            string getChampsPath(string fileName) => RES_FOLDER_PATH + @"Champs(140x140)\" + fileName + "_140140.png";
            string getRunePath(string fileName)
            {
                string returnValue = RES_FOLDER_PATH + @"Runes(140x140)\" + fileName + ".png"; 
                return returnValue.Replace("Legend:", "Legend");
            }

            LoadScene(sceneNameKeyStone);

            SetValue("B_PlayerName1", blue.Top.Name);
            SetValue("B_PlayerName2", blue.Jungle.Name);
            SetValue("B_PlayerName3", blue.Mid.Name);
            SetValue("B_PlayerName4", blue.ADCarry.Name);
            SetValue("B_PlayerName5", blue.Supporter.Name);

            SetValue("R_PlayerName1", red.Top.Name);
            SetValue("R_PlayerName2", red.Jungle.Name);
            SetValue("R_PlayerName3", red.Mid.Name);
            SetValue("R_PlayerName4", red.ADCarry.Name);
            SetValue("R_PlayerName5", red.Supporter.Name);


            for (int i = 0; i < dt.Rows.Count; i++)
            {
                string BR = i < 5 ? "B" : "R";
                int index = i < 5 ? i + 1 : i - 4;                

                //챔피언
                string champName = dt.Rows[i][2].ToString();
                SetValue(BR + "_Champion" + index, getChampsPath(champName));

                //메인룬
                string mainRune = dt.Rows[i][4].ToString();
                SetValue(BR + "_KeystoneRunes" + index, getRunePath(mainRune));

                //서브룬
                string subRune = dt.Rows[i][6].ToString();
                SetValue(BR + "_KeystoneRunes_Sub" + index, getRunePath(subRune));
 
            }

            Prepare(mainLayer);
            Play(mainLayer);
        }

        public void DisplayChampWinRate(Liners liners, string[] winRate, bool isBlue)
        {

            string getChampsPath(string fileName) => RES_FOLDER_PATH + @"Champs(140x140)\" + fileName + "_140140.png"; 

            LoadScene(sceneNameWinRate);

            //팀색상
            if (isBlue)
            {
                KAScene.GetObject("B_Team_Color_bar").SetVisible(1);
                KAScene.GetObject("R_Team_Color_bar").SetVisible(0);
                //KAScene.GetObject("Team_Color_bar").SetDiffuse(90, 196, 204);  //(243, 58, 89, 255);                
            }
            else
            {
                KAScene.GetObject("B_Team_Color_bar").SetVisible(0);
                KAScene.GetObject("R_Team_Color_bar").SetVisible(1);
                //KAScene.GetObject("Team_Color_bar").SetDiffuse(243, 58, 89);      //(90, 196, 204, 255);
            }
            KAScene.GetObject("Team_Box").SetValue(_designPath + "TeamLogo\\POST\\" + liners.TeamName + ".png");

            //팀명
            KAScene.GetObject("Team_Name").SetValue(liners.TeamName);
            //팀로고            
            KAScene.GetObject("Team_Logo").SetValue(RES_FOLDER_PATH + "Team Logo(1080x1080)\\" + liners.TeamName + ".png");

            //챔프이미지
            KAScene.GetObject("Playername1").SetValue(liners.Top.Name);
            KAScene.GetObject("Champion_Image1").SetValue(RES_FOLDER_PATH + "Champs(520x370)\\" + liners.Top.champ + "_L.png");
            KAScene.GetObject("Win Rating1").SetValue(winRate[0]);

            KAScene.GetObject("Playername2").SetValue(liners.Jungle.Name);
            KAScene.GetObject("Champion_Image2").SetValue(RES_FOLDER_PATH + "Champs(520x370)\\" + liners.Jungle.champ + "_L.png");
            KAScene.GetObject("Win Rating2").SetValue(winRate[1]);

            KAScene.GetObject("Playername3").SetValue(liners.Mid.Name);
            KAScene.GetObject("Champion_Image3").SetValue(RES_FOLDER_PATH + "Champs(520x370)\\" + liners.Mid.champ + "_L.png");
            KAScene.GetObject("Win Rating3").SetValue(winRate[2]);

            KAScene.GetObject("Playername4").SetValue(liners.ADCarry.Name);
            KAScene.GetObject("Champion_Image4").SetValue(RES_FOLDER_PATH + "Champs(520x370)\\" + liners.ADCarry.champ + "_L.png");
            KAScene.GetObject("Win Rating4").SetValue(winRate[3]);

            KAScene.GetObject("Playername5").SetValue(liners.Supporter.Name);
            KAScene.GetObject("Champion_Image5").SetValue(RES_FOLDER_PATH + "Champs(520x370)\\" + liners.Supporter.champ + "_L.png");
            KAScene.GetObject("Win Rating5").SetValue(winRate[4]);


            Prepare(mainLayer);
            Play(mainLayer);
        }

        #endregion


        #region 타워 정보


        public void DisplayTower(string blue, string red)
        {
            LoadScene(sceneNameTower);
            KAEngine.BeginTransaction();

            KAScene.GetObject("BT").SetValue(blue);
            KAScene.GetObject("RT").SetValue(red);
            
            KAScene.QueryVariables();
            KAEngine.EndTransaction();

            Prepare(layoutTower);
            Play(layoutTower);

            isDisplayTower = true;
        }

        public void OutTower()
        {
            isDisplayTower = false;
            Out(layoutTower);

        }

        #endregion


        #region 억제기타이머

        public void DisplayInhibitor(string t1, string t2, string t3, string t4, string t5, string t6, string t7, string t8, string t9, string t10, bool isBlue)
        {
            LoadScene(isBlue? sceneNameInhibitorBlue : sceneNameInhibitorRed); 

            if (isBlue && isDisplayInhibitorBlue)
            {
                eKSceneEffectType etype = eKSceneEffectType.SCENE_CHANGE_EFFECT_NONE;
                KAScene.SetSceneEffectType(1, etype, 0);
            }
            else if (!isBlue && isDisplayInhibitorRed)
            {
                eKSceneEffectType etype = eKSceneEffectType.SCENE_CHANGE_EFFECT_NONE;
                KAScene.SetSceneEffectType(1, etype, 0);
            }
            else
            {
                //첫송출
                eKSceneEffectType etype = eKSceneEffectType.SCENE_CHANGE_EFFECT_FADE;
                KAScene.SetSceneEffectType(1, etype, FadeInSec);
            }

            string BR = isBlue ?  "B" : "R";
            if (t1.Equals("05")) t1 = "00";
            if (t3.Equals("05")) t3 = "00";
            if (t5.Equals("05")) t5 = "00";
            if (t7.Equals("03")) t7 = "00";
            if (t9.Equals("03")) t9 = "00";

            for (int i = 0; i < 5; i++)
            {
                string min = t1;
                string sec = t2;
                string line = "Top";
                if (i == 1) { min = t3; sec = t4; line = "Mid"; }
                if (i == 2) { min = t5; sec = t6; line = "Bot"; }
                if (i == 3) { min = t7; sec = t8; line = "Upper"; }
                if (i == 4) { min = t9; sec = t10; line = "Lower"; }


                KAObject kAObject;

                if (min.Equals("00") && sec.Equals("00"))
                {
                    KAScene.GetObject(BR + "_Timer_" + line).SetVisible(0);
                    kAObject = KAScene.GetObject(BR + "_Timer_" + line +"_1");
                    kAObject.SetVisible(1);
                }
                else
                {
                    KAScene.GetObject(BR + "_Timer_" + line +"_1").SetVisible(0);                    
                    kAObject = KAScene.GetObject(BR + "_Timer_" + line);
                    kAObject.SetVisible(1);
                }
                kAObject.SetValue(min.Substring(1) + ":" + sec);
            } 

            Prepare(isBlue? layoutInhibitorBlue : layoutInhibitorRed);
            Play(isBlue ? layoutInhibitorBlue : layoutInhibitorRed);

            if (isBlue) isDisplayInhibitorBlue = true;
            else isDisplayInhibitorRed = true; 
        }

        public void OutInhibitor(bool isBlue)
        {
            if (isBlue) isDisplayInhibitorBlue = false;
            else isDisplayInhibitorRed = false;

            Out(isBlue? layoutInhibitorBlue : layoutInhibitorRed);

        }

        #endregion


        #region 누적골드

        public void DisplayQuest(DataTable dt, DataControl dc)
        {
            string getChampsPath(string fileName) => RES_FOLDER_PATH + @"Champs(140x140)\" + fileName + "_140140.png";

            LoadScene(sceneNameQuest);

            foreach (DataRow dr in dt.Rows)
            {
                if (dc.BlueLiner.Top.champ.Equals(dr[2].ToString())) { dc.BlueLiner.Top.isQuest = Convert.ToBoolean(dr[3].ToString()); }
                else if (dc.BlueLiner.Jungle.champ.Equals(dr[2].ToString())) { dc.BlueLiner.Jungle.isQuest = Convert.ToBoolean(dr[3].ToString()); }
                else if (dc.BlueLiner.Mid.champ.Equals(dr[2].ToString())) { dc.BlueLiner.Mid.isQuest = Convert.ToBoolean(dr[3].ToString()); }
                else if (dc.BlueLiner.ADCarry.champ.Equals(dr[2].ToString())) { dc.BlueLiner.ADCarry.isQuest = Convert.ToBoolean(dr[3].ToString()); }
                else if (dc.BlueLiner.Supporter.champ.Equals(dr[2].ToString())) { dc.BlueLiner.Supporter.isQuest = Convert.ToBoolean(dr[3].ToString()); }
                else if (dc.RedLiner.Top.champ.Equals(dr[2].ToString())) { dc.RedLiner.Top.isQuest = Convert.ToBoolean(dr[3].ToString()); }
                else if (dc.RedLiner.Jungle.champ.Equals(dr[2].ToString())) { dc.RedLiner.Jungle.isQuest = Convert.ToBoolean(dr[3].ToString()); }
                else if (dc.RedLiner.Mid.champ.Equals(dr[2].ToString())) { dc.RedLiner.Mid.isQuest = Convert.ToBoolean(dr[3].ToString()); }
                else if (dc.RedLiner.ADCarry.champ.Equals(dr[2].ToString())) { dc.RedLiner.ADCarry.isQuest = Convert.ToBoolean(dr[3].ToString()); }
                else if (dc.RedLiner.Supporter.champ.Equals(dr[2].ToString())) { dc.RedLiner.Supporter.isQuest = Convert.ToBoolean(dr[3].ToString()); }
            }

            //챔프 이미지
            KAScene.GetObject("B_Player_1").SetValue(getChampsPath(dc.BlueLiner.Top.champ));
            KAScene.GetObject("B_Player_2").SetValue(getChampsPath(dc.BlueLiner.Jungle.champ));
            KAScene.GetObject("B_Player_3").SetValue(getChampsPath(dc.BlueLiner.Mid.champ));
            KAScene.GetObject("B_Player_4").SetValue(getChampsPath(dc.BlueLiner.ADCarry.champ));
            KAScene.GetObject("B_Player_5").SetValue(getChampsPath(dc.BlueLiner.Supporter.champ));

            KAScene.GetObject("R_Player_1").SetValue(getChampsPath(dc.RedLiner.Top.champ));
            KAScene.GetObject("R_Player_2").SetValue(getChampsPath(dc.RedLiner.Jungle.champ));
            KAScene.GetObject("R_Player_3").SetValue(getChampsPath(dc.RedLiner.Mid.champ));
            KAScene.GetObject("R_Player_4").SetValue(getChampsPath(dc.RedLiner.ADCarry.champ));
            KAScene.GetObject("R_Player_5").SetValue(getChampsPath(dc.RedLiner.Supporter.champ));

            //텍스트 OnOff
            SetVisible("B_Text_1", dc.BlueLiner.Top.isQuest);
            SetVisible("B_Text_2", dc.BlueLiner.Jungle.isQuest);
            SetVisible("B_Text_3", dc.BlueLiner.Mid.isQuest);
            SetVisible("B_Text_4", dc.BlueLiner.ADCarry.isQuest);
            SetVisible("B_Text_5", dc.BlueLiner.Supporter.isQuest);

            SetVisible("R_Text_1", dc.RedLiner.Top.isQuest);
            SetVisible("R_Text_2", dc.RedLiner.Jungle.isQuest);
            SetVisible("R_Text_3", dc.RedLiner.Mid.isQuest);
            SetVisible("R_Text_4", dc.RedLiner.ADCarry.isQuest);
            SetVisible("R_Text_5", dc.RedLiner.Supporter.isQuest);

            //달성이미지
            string getLinePath(string pos, bool isQuest)
            {
                string done = isQuest ? "_COM" : "_NONE";
                return RES_FOLDER_PATH + @"RoleQuest\" + pos + done + ".png";
            }            
            KAScene.GetObject("B_Pos_1").SetValue(getLinePath("TOP", dc.BlueLiner.Top.isQuest));
            KAScene.GetObject("B_Pos_2").SetValue(getLinePath("JGL", dc.BlueLiner.Jungle.isQuest));
            KAScene.GetObject("B_Pos_3").SetValue(getLinePath("MID", dc.BlueLiner.Mid.isQuest));
            KAScene.GetObject("B_Pos_4").SetValue(getLinePath("BOT", dc.BlueLiner.ADCarry.isQuest));
            KAScene.GetObject("B_Pos_5").SetValue(getLinePath("SPT", dc.BlueLiner.Supporter.isQuest));

            KAScene.GetObject("R_Pos_1").SetValue(getLinePath("TOP", dc.RedLiner.Top.isQuest));
            KAScene.GetObject("R_Pos_2").SetValue(getLinePath("JGL", dc.RedLiner.Jungle.isQuest));
            KAScene.GetObject("R_Pos_3").SetValue(getLinePath("MID", dc.RedLiner.Mid.isQuest));
            KAScene.GetObject("R_Pos_4").SetValue(getLinePath("BOT", dc.RedLiner.ADCarry.isQuest));
            KAScene.GetObject("R_Pos_5").SetValue(getLinePath("SPT", dc.RedLiner.Supporter.isQuest));

            Prepare(1);
            KAScenePlayer.Play(1);
        }

        public void DisplayGold(DataTable dt, DataControl dc, bool isT1Home, Color blueC, Color redC)
        {
            string getChampsPath(string fileName) => RES_FOLDER_PATH + @"Champs(140x140)\" + fileName + "_140140.png";

            LoadScene(sceneNameGold); 
            
            if (isDisplayGold)
            {
                KAScene = KAScenePlayer.GetPlayingScene(1);
                KAEngine.BeginTransaction();
            }
            
             

            foreach(DataRow dr in dt.Rows)
            { 
                if (dc.BlueLiner.Top.champ.Equals(dr[2].ToString()))  { dc.BlueLiner.Top.GoldHave = dr[4].ToString(); dc.BlueLiner.Top.GoldSum = dr[3].ToString(); dc.BlueLiner.Top.GoldRate = dr[5].ToString(); }
                else if (dc.BlueLiner.Jungle.champ.Equals(dr[2].ToString())) { dc.BlueLiner.Jungle.GoldHave = dr[4].ToString(); dc.BlueLiner.Jungle.GoldSum = dr[3].ToString(); dc.BlueLiner.Jungle.GoldRate = dr[5].ToString(); }
                else if (dc.BlueLiner.Mid.champ.Equals(dr[2].ToString())) { dc.BlueLiner.Mid.GoldHave = dr[4].ToString(); dc.BlueLiner.Mid.GoldSum = dr[3].ToString(); dc.BlueLiner.Mid.GoldRate = dr[5].ToString(); }
                else if (dc.BlueLiner.ADCarry.champ.Equals(dr[2].ToString())) { dc.BlueLiner.ADCarry.GoldHave = dr[4].ToString(); dc.BlueLiner.ADCarry.GoldSum = dr[3].ToString(); dc.BlueLiner.ADCarry.GoldRate = dr[5].ToString(); }
                else if (dc.BlueLiner.Supporter.champ.Equals(dr[2].ToString())) { dc.BlueLiner.Supporter.GoldHave = dr[4].ToString(); dc.BlueLiner.Supporter.GoldSum = dr[3].ToString(); dc.BlueLiner.Supporter.GoldRate = dr[5].ToString(); }
                else if (dc.RedLiner.Top.champ.Equals(dr[2].ToString())) { dc.RedLiner.Top.GoldHave = dr[4].ToString(); dc.RedLiner.Top.GoldSum = dr[3].ToString(); dc.RedLiner.Top.GoldRate = dr[5].ToString(); }
                else if (dc.RedLiner.Jungle.champ.Equals(dr[2].ToString())) { dc.RedLiner.Jungle.GoldHave = dr[4].ToString(); dc.RedLiner.Jungle.GoldSum = dr[3].ToString(); dc.RedLiner.Jungle.GoldRate = dr[5].ToString(); }
                else if (dc.RedLiner.Mid.champ.Equals(dr[2].ToString())) { dc.RedLiner.Mid.GoldHave = dr[4].ToString(); dc.RedLiner.Mid.GoldSum = dr[3].ToString(); dc.RedLiner.Mid.GoldRate = dr[5].ToString(); }
                else if (dc.RedLiner.ADCarry.champ.Equals(dr[2].ToString())) { dc.RedLiner.ADCarry.GoldHave = dr[4].ToString(); dc.RedLiner.ADCarry.GoldSum = dr[3].ToString(); dc.RedLiner.ADCarry.GoldRate = dr[5].ToString(); }
                else if (dc.RedLiner.Supporter.champ.Equals(dr[2].ToString())) { dc.RedLiner.Supporter.GoldHave = dr[4].ToString(); dc.RedLiner.Supporter.GoldSum = dr[3].ToString(); dc.RedLiner.Supporter.GoldRate = dr[5].ToString(); } 
            }
 

            //챔프 이미지
            KAScene.GetObject("R_Player1 Image").SetValue(getChampsPath(dc.BlueLiner.Top.champ));
            KAScene.GetObject("R_Player2 Image").SetValue(getChampsPath(dc.BlueLiner.Jungle.champ));
            KAScene.GetObject("R_Player3 Image").SetValue(getChampsPath(dc.BlueLiner.Mid.champ));
            KAScene.GetObject("R_Player4 Image").SetValue(getChampsPath(dc.BlueLiner.ADCarry.champ));
            KAScene.GetObject("R_Player5 Image").SetValue(getChampsPath(dc.BlueLiner.Supporter.champ));

            KAScene.GetObject("B_Player1 Image").SetValue(getChampsPath(dc.RedLiner.Top.champ));
            KAScene.GetObject("B_Player2 Image").SetValue(getChampsPath(dc.RedLiner.Jungle.champ));
            KAScene.GetObject("B_Player3 Image").SetValue(getChampsPath(dc.RedLiner.Mid.champ));
            KAScene.GetObject("B_Player4 Image").SetValue(getChampsPath(dc.RedLiner.ADCarry.champ));
            KAScene.GetObject("B_Player5 Image").SetValue(getChampsPath(dc.RedLiner.Supporter.champ));

            //골드
            string GoldConverter(Liner liner)
            {
                string first =  string.Format("{0:0.0}", Convert.ToDouble(liner.GoldSum) / 1000) + "K";
                return first;
                //return first  + "(" + liner.GoldHave + ")";
            }
            string GoldConverter2(Liner liner)
            {
                //string first = string.Format("{0:0.0}", Convert.ToDouble(liner.GoldSum) / 1000) + "K"; 
                return liner.GoldHave;
            }

            KAScene.GetObject("R_Player1_Gold").SetValue(GoldConverter(dc.BlueLiner.Top));
            KAScene.GetObject("R_Player2_Gold").SetValue(GoldConverter(dc.BlueLiner.Jungle));
            KAScene.GetObject("R_Player3_Gold").SetValue(GoldConverter(dc.BlueLiner.Mid));
            KAScene.GetObject("R_Player4_Gold").SetValue(GoldConverter(dc.BlueLiner.ADCarry));
            KAScene.GetObject("R_Player5_Gold").SetValue(GoldConverter(dc.BlueLiner.Supporter));
            KAScene.GetObject("B_Player1_Gold").SetValue(GoldConverter(dc.RedLiner.Top));
            KAScene.GetObject("B_Player2_Gold").SetValue(GoldConverter(dc.RedLiner.Jungle));
            KAScene.GetObject("B_Player3_Gold").SetValue(GoldConverter(dc.RedLiner.Mid));
            KAScene.GetObject("B_Player4_Gold").SetValue(GoldConverter(dc.RedLiner.ADCarry));
            KAScene.GetObject("B_Player5_Gold").SetValue(GoldConverter(dc.RedLiner.Supporter));

            KAScene.GetObject("R_Player1_Gold2").SetValue(GoldConverter2(dc.BlueLiner.Top));
            KAScene.GetObject("R_Player2_Gold2").SetValue(GoldConverter2(dc.BlueLiner.Jungle));
            KAScene.GetObject("R_Player3_Gold2").SetValue(GoldConverter2(dc.BlueLiner.Mid));
            KAScene.GetObject("R_Player4_Gold2").SetValue(GoldConverter2(dc.BlueLiner.ADCarry));
            KAScene.GetObject("R_Player5_Gold2").SetValue(GoldConverter2(dc.BlueLiner.Supporter));
            KAScene.GetObject("B_Player1_Gold2").SetValue(GoldConverter2(dc.RedLiner.Top));
            KAScene.GetObject("B_Player2_Gold2").SetValue(GoldConverter2(dc.RedLiner.Jungle));
            KAScene.GetObject("B_Player3_Gold2").SetValue(GoldConverter2(dc.RedLiner.Mid));
            KAScene.GetObject("B_Player4_Gold2").SetValue(GoldConverter2(dc.RedLiner.ADCarry));
            KAScene.GetObject("B_Player5_Gold2").SetValue(GoldConverter2(dc.RedLiner.Supporter));

            //골드차
            string GoldGap(Liner liner1, Liner liner2)
            {
                int b = Convert.ToInt32(liner1.GoldSum);
                int r = Convert.ToInt32(liner2.GoldSum);
                return (b - r).ToString();
            }
            void setGoldGap(int index, Liner liner1, Liner liner2)
            {
                string gap = GoldGap(liner1, liner2);
                if (gap.Substring(0, 1).Equals("-"))
                {
                    gap = gap.Substring(1);
                    if (isT1Home)
                    {
                        KAScene.GetObject("Player" + index + "_MiddleGold").SetFaceTextColor(0, gap.Length, redC.R, redC.G, redC.B, 255);
                    }
                    else
                    {
                        KAScene.GetObject("Player" + index + "_MiddleGold").SetFaceTextColor(0, gap.Length, 255, 47, 79, 255);
                    }
                    
                }
                else
                {
                    if (isT1Home)
                    {
                        KAScene.GetObject("Player" + index + "_MiddleGold").SetFaceTextColor(0, gap.Length, blueC.R, blueC.G, blueC.B, 255);
                    }
                    else
                    {
                        KAScene.GetObject("Player" + index + "_MiddleGold").SetFaceTextColor(0, gap.Length, 55, 73, 235, 255);
                    } 
                }

                KAScene.GetObject("Player" + index + "_MiddleGold").SetValue(gap);
            }
            setGoldGap(1, dc.BlueLiner.Top, dc.RedLiner.Top);
            setGoldGap(2, dc.BlueLiner.Jungle, dc.RedLiner.Jungle);
            setGoldGap(3, dc.BlueLiner.Mid, dc.RedLiner.Mid);
            setGoldGap(4, dc.BlueLiner.ADCarry, dc.RedLiner.ADCarry);
            setGoldGap(5, dc.BlueLiner.Supporter, dc.RedLiner.Supporter);

            //그래프 길이
            void setGraphB(int index,string Rate)
            {
                KAScene.GetObject("R_Player" + index + "_GoldBar").SetSize(Convert.ToInt32((Convert.ToDouble(Rate) * 3.3)), 16, 100);
                KAScene.GetObject("R_Player" + index + "_GoldBar").SetPosition((330 - Convert.ToInt32((Convert.ToDouble(Rate) * 3.3)) / 2), 88, 0, eKVectorType.VECTOR_TYPE_X);
            }
            void setGraphR(int index, string Rate)
            { 
                KAScene.GetObject("B_Player" + index + "_GoldBar").SetSize(Convert.ToInt32((Convert.ToDouble(Rate) * 3.3)), 16, 100);
                KAScene.GetObject("B_Player" + index + "_GoldBar").SetPosition((-330 + Convert.ToInt32((Convert.ToDouble(Rate) * 3.3)) / 2), 88, 0, eKVectorType.VECTOR_TYPE_X);
            }

            if (isT1Home)
            {
                for (int i = 1; i < 6; i++)
                {
                    KAScene.GetObject("R_Player" + i + "_GoldBar").SetFaceColor(redC.R, redC.G, redC.B, 255);
                    KAScene.GetObject("B_Player" + i + "_GoldBar").SetFaceColor(blueC.R, blueC.G, blueC.B, 255);
                }
            }
            else
            {
                for (int i = 1; i < 6; i++)
                {
                    KAScene.GetObject("R_Player" + i + "_GoldBar").SetFaceColor(255, 47, 79, 255);
                    KAScene.GetObject("B_Player" + i + "_GoldBar").SetFaceColor(55, 73, 235, 255);
                }
            }

            setGraphR(1, dc.BlueLiner.Top.GoldRate);
            setGraphR(2, dc.BlueLiner.Jungle.GoldRate);
            setGraphR(3, dc.BlueLiner.Mid.GoldRate);
            setGraphR(4, dc.BlueLiner.ADCarry.GoldRate);
            setGraphR(5, dc.BlueLiner.Supporter.GoldRate);

            setGraphB(1, dc.RedLiner.Top.GoldRate);
            setGraphB(2, dc.RedLiner.Jungle.GoldRate);
            setGraphB(3, dc.RedLiner.Mid.GoldRate);
            setGraphB(4, dc.RedLiner.ADCarry.GoldRate);
            setGraphB(5, dc.RedLiner.Supporter.GoldRate);
        


            if (isDisplayGold)
            {                 
                KAScene.QueryVariables();
                KAEngine.EndTransaction();
                KAScenePlayer.PlayDirect(1, KAScene);
            }
            else
            {
                Prepare(1);
                KAScenePlayer.Play(1);
                isDisplayGold = true;
            }
             
        } 

        public void DisplayGoldGraph(int time, int row, double max, double min, string path)
        {
            LoadScene(sceneNameGoldGraph);

            //chartControl1.Dispose();
            if (isDisplayGoldGraph)
            {
                KAScene = KAScenePlayer.GetPlayingScene(1);
                KAEngine.BeginTransaction();
            }
            string d_min = (min / 1000).ToString("##0.0");

            if (d_min != "")
            {
                if (d_min.Substring(0, 1) == "-")
                    d_min = d_min.Substring(1);

                KAScene.GetObject("Min").SetValue(d_min + "K");
                KAScene.GetObject("Max").SetValue((max / 1000).ToString("##0.0") + "K");
                KAScene.GetObject("Graph").SetValue(path);
                                 

                KAScene.GetObject("t4").SetValue((time / 60).ToString());

                time = ((time / 4) / 60);

                for (int i = 1; i <= 3; i++)
                {
                    KAScene.GetObject("t" + i.ToString()).SetValue((time * i).ToString());
                }




                if (isDisplayGoldGraph)
                {
                    //KAScene.AddPause(0, 70, 0, 0);
                    KAScene.QueryVariables();
                    KAEngine.EndTransaction();
                    KAScenePlayer.PlayDirect(1, KAScene);
                    //KAScenePlayer.Play(1);
                } else
                {
                    Prepare(1);
                    Play(1);
                    isDisplayGoldGraph = true;
                }
            }
        }

        public void DisplayDeal(DataTable dt, DataControl dc)
        {
            string getChampsPath(string fileName) => RES_FOLDER_PATH + @"Champs(140x140)\" + fileName + "_140140.png";

            LoadScene(sceneNameDeal);

            if (isDisplayDeal)
            {
                KAScene = KAScenePlayer.GetPlayingScene(1);
                KAEngine.BeginTransaction();
            }

            KAScene.GetObject("Title").SetValue("TOTAL DAMAGE DEALT");

            string[][] blue = new string[5][];
            string[][] red = new string[5][];

            foreach (DataRow dr in dt.Rows)
            {
                if (dc.BlueLiner.Top.champ.Equals(dr[2])) blue[0] = new string[] {dr[2].ToString(),  dr[3].ToString(), dr[4].ToString() };
                else if (dc.BlueLiner.Jungle.champ.Equals(dr[2])) blue[1] = new string[] { dr[2].ToString(), dr[3].ToString(), dr[4].ToString() };
                else if (dc.BlueLiner.Mid.champ.Equals(dr[2])) blue[2] = new string[] { dr[2].ToString(), dr[3].ToString(), dr[4].ToString() };
                else if (dc.BlueLiner.ADCarry.champ.Equals(dr[2])) blue[3] = new string[] { dr[2].ToString(), dr[3].ToString(), dr[4].ToString() };
                else if (dc.BlueLiner.Supporter.champ.Equals(dr[2])) blue[4] = new string[] { dr[2].ToString(), dr[3].ToString(), dr[4].ToString() };

                else if (dc.RedLiner.Top.champ.Equals(dr[2])) red[0] = new string[] { dr[2].ToString(), dr[3].ToString(), dr[4].ToString() };
                else if (dc.RedLiner.Jungle.champ.Equals(dr[2])) red[1] = new string[] { dr[2].ToString(), dr[3].ToString(), dr[4].ToString() };
                else if (dc.RedLiner.Mid.champ.Equals(dr[2])) red[2] = new string[] { dr[2].ToString(), dr[3].ToString(), dr[4].ToString() };
                else if (dc.RedLiner.ADCarry.champ.Equals(dr[2])) red[3] = new string[] { dr[2].ToString(), dr[3].ToString(), dr[4].ToString() };
                else if (dc.RedLiner.Supporter.champ.Equals(dr[2])) red[4] = new string[] { dr[2].ToString(), dr[3].ToString(), dr[4].ToString() };
            }

            for (int i = 0; i < 5; i++)
            {
                KAScene.GetObject("B_Player" + (i+1) + "_GoldBar").SetSize(Convert.ToInt32((Convert.ToDouble( blue[i][2]) * 3.6)), 16, 100);
                KAScene.GetObject("B_Player" + (i + 1) + "_GoldBar").SetPosition((-360 + Convert.ToInt32((Convert.ToDouble(blue[i][2]) * 3.6)) / 2), 88, 0, eKVectorType.VECTOR_TYPE_X);

                KAScene.GetObject("R_Player" + (i + 1) + "_GoldBar").SetSize(Convert.ToInt32((Convert.ToDouble(red[i][2]) * 3.6)), 16, 100);
                KAScene.GetObject("R_Player" + (i + 1) + "_GoldBar").SetPosition((360 - Convert.ToInt32((Convert.ToDouble(red[i][2]) * 3.6)) / 2), 88, 0, eKVectorType.VECTOR_TYPE_X);

                KAScene.GetObject("B_Player" + (i + 1) + "_Gold").SetValue(Convert.ToDouble(blue[i][1]).ToString("0"));
                KAScene.GetObject("R_Player" + (i + 1) + "_Gold").SetValue(Convert.ToDouble(red[i][1]).ToString("0"));

                KAScene.GetObject("B_Player" + (i + 1) + " Image").SetValue(getChampsPath(blue[i][0]));
                KAScene.GetObject("R_Player" + (i + 1) + " Image").SetValue(getChampsPath(red[i][0]));
            }
             

            if (isDisplayDeal)
            {
                KAScene.QueryVariables();
                KAEngine.EndTransaction();
                KAScenePlayer.PlayDirect(1, KAScene);
            }
            else
            {
                Prepare(1);
                KAScenePlayer.Play(1);
                isDisplayDeal = true;
            }
        }

        #endregion


        #region 한타딜량

        public void DisplayFight(bool isRealTime, string timeInfo, DataTable dt, DataControl dc, bool isNewDesign = false)
        {
            string getChampsPath(string fileName) => RES_FOLDER_PATH + @"Champs(140x140)\" + fileName + "_140140.png";

            if (isNewDesign) LoadScene(sceneNameFightNew);
            else LoadScene(sceneNameFight);

            if (isDisplayFight)
            {
                KAScene = KAScenePlayer.GetPlayingScene(1);
                KAEngine.BeginTransaction();
            }

            string title = isRealTime ? "LIVE DAMAGE DEALT" : "DAMAGE DEALT" + "  (" + timeInfo + ")";

            KAScene.GetObject("Title").SetValue(title);

            string[][] blue = new string[5][];
            string[][] red = new string[5][];

            foreach (DataRow dr in dt.Rows)
            {
                string data1 = dr[2].ToString();
                string data2 = isRealTime ? dr[5].ToString() : dr[3].ToString();
                string data3 = isRealTime ? dr[6].ToString() : dr[6].ToString();

                if (dc.BlueLiner.Top.champ.Equals(dr[2])) blue[0] = new string[] { data1, data2, data3 };
                else if (dc.BlueLiner.Jungle.champ.Equals(dr[2])) blue[1] = new string[] { data1, data2, data3 };
                else if (dc.BlueLiner.Mid.champ.Equals(dr[2])) blue[2] = new string[] { data1, data2, data3 };
                else if (dc.BlueLiner.ADCarry.champ.Equals(dr[2])) blue[3] = new string[] { data1, data2, data3 };
                else if (dc.BlueLiner.Supporter.champ.Equals(dr[2])) blue[4] = new string[] { data1, data2, data3 };

                else if (dc.RedLiner.Top.champ.Equals(dr[2])) red[0] = new string[] { data1, data2, data3 };
                else if (dc.RedLiner.Jungle.champ.Equals(dr[2])) red[1] = new string[] { data1, data2, data3 };
                else if (dc.RedLiner.Mid.champ.Equals(dr[2])) red[2] = new string[] { data1, data2, data3 };
                else if (dc.RedLiner.ADCarry.champ.Equals(dr[2])) red[3] = new string[] { data1, data2, data3 };
                else if (dc.RedLiner.Supporter.champ.Equals(dr[2])) red[4] = new string[] { data1, data2, data3 };
            }

            //최대데미지 확인 및 보여주기
            if (isNewDesign)
            {
                bool isTopRed = true;
                int topIndex = -1;
                double damage = 1;

                for (int i = 0; i < 5; i++)
                {
                    KAScene.GetObject("B_Player" + (i + 1) + "_Top").SetVisible(0);
                    KAScene.GetObject("R_Player" + (i + 1) + "_Top").SetVisible(0);

                    if (damage < Convert.ToDouble(blue[i][1]))
                    {
                        damage = Convert.ToDouble(blue[i][1]);
                        isTopRed = false;
                        topIndex = (i + 1);
                    }
                    if (damage < Convert.ToDouble(red[i][1]))
                    {
                        damage = Convert.ToDouble(red[i][1]);
                        isTopRed = true;
                        topIndex = (i + 1);
                    }
                }

                if (topIndex != -1)
                {
                    if (isTopRed) KAScene.GetObject("R_Player" + topIndex + "_Top").SetVisible(1);
                    else KAScene.GetObject("B_Player" + topIndex + "_Top").SetVisible(1);
                }
            }

            for (int i = 0; i < 5; i++)
            {
                if (!isNewDesign)
                {
                    KAScene.GetObject("B_Player" + (i + 1) + "_GoldBar").SetSize(Convert.ToInt32((Convert.ToDouble(blue[i][2]) * 3.6)), 16, 100);
                    KAScene.GetObject("B_Player" + (i + 1) + "_GoldBar").SetPosition((-360 + Convert.ToInt32((Convert.ToDouble(blue[i][2]) * 3.6)) / 2), 88, 0, eKVectorType.VECTOR_TYPE_X);

                    KAScene.GetObject("R_Player" + (i + 1) + "_GoldBar").SetSize(Convert.ToInt32((Convert.ToDouble(red[i][2]) * 3.6)), 16, 100);
                    KAScene.GetObject("R_Player" + (i + 1) + "_GoldBar").SetPosition((360 - Convert.ToInt32((Convert.ToDouble(red[i][2]) * 3.6)) / 2), 88, 0, eKVectorType.VECTOR_TYPE_X);
                }

                KAScene.GetObject("B_Player" + (i + 1) + "_Gold").SetValue(Convert.ToDouble(blue[i][1]).ToString("0"));
                KAScene.GetObject("R_Player" + (i + 1) + "_Gold").SetValue(Convert.ToDouble(red[i][1]).ToString("0"));

                KAScene.GetObject("B_Player" + (i + 1) + " Image").SetValue(getChampsPath(blue[i][0]));
                KAScene.GetObject("R_Player" + (i + 1) + " Image").SetValue(getChampsPath(red[i][0]));
            }

            if (isDisplayFight)
            {
                KAScene.QueryVariables();
                KAEngine.EndTransaction();
                KAScenePlayer.PlayDirect(1, KAScene);
            }
            else
            {
                Prepare(1);
                KAScenePlayer.Play(1);
                isDisplayFight = true;
            }

        }

        #endregion


        #region Post
        public string[] ForResultGold = new string[5];


      

        public void DisplayPost(DataTable[] dts, DataControl dc, string[] titles, string[] scores, bool isT1Home, Color winC, Color lossC, Color blueC, Color redC, bool kda수동, string KDABlue, string KDARed)
        { 
            LoadScene(sceneNamePost);


            //게임시간
            int time = Convert.ToInt32(dts[2].Rows[0][1]);
            int min_ = (time / 60);
            int sec = (time % 60);
            string timeT = string.Empty;
            if (sec < 10) timeT = min_.ToString() + ":0" + sec.ToString();
            else timeT = min_.ToString() + ":" + sec.ToString();
            KAScene.GetObject("Game_Timer").SetValue(timeT); 

            //승패
            if (dts[2].Rows[0][0].Equals("블루"))
            {
                if (isT1Home)
                {
                    KAScene.GetObject("Win").SetFaceTextColor(0, 3, winC.R, winC.G, winC.B, winC.A);
                    KAScene.GetObject("Loss").SetFaceTextColor(0, 4, lossC.R, lossC.G, lossC.B, lossC.A);                    
                }
                else
                {
                    KAScene.GetObject("Win").SetFaceTextColor(0, 3, 31, 26, 46, 255);
                    KAScene.GetObject("Loss").SetFaceTextColor(0, 4, 31, 26, 46, 115);
                }
                
                //KAScene.GetObject("Win").SetValue("WIN");
                //KAScene.GetObject("Loss").SetValue("LOSS");
                KAScene.GetObject("Win").SetValue("W");
                KAScene.GetObject("Loss").SetValue("L");

                Color color = Color.FromArgb(218256);
                 
                KAScene.GetObject("B_Team_Box").SetValue(_designPath + "TeamLogo\\POST\\" + dc.BlueLiner.TeamName + ".png");
                KAScene.GetObject("R_Team_Box").SetValue(_designPath + "TeamLogo\\POST\\LOSS-TEAM.png");

            }
            else
            {
                if (isT1Home)
                {
                    KAScene.GetObject("Win").SetFaceTextColor(0, 3, lossC.R, lossC.G, lossC.B, lossC.A);
                    KAScene.GetObject("Loss").SetFaceTextColor(0, 4, winC.R, winC.G, winC.B, winC.A);
                }
                else
                {
                    KAScene.GetObject("Win").SetFaceTextColor(0, 3, 31, 26, 46, 115);
                    KAScene.GetObject("Loss").SetFaceTextColor(0, 4, 31, 26, 46, 255);
                }
                
                //KAScene.GetObject("Win").SetValue("LOSS");
                //KAScene.GetObject("Loss").SetValue("WIN");
                KAScene.GetObject("Win").SetValue("L");
                KAScene.GetObject("Loss").SetValue("W");

                KAScene.GetObject("R_Team_Box").SetValue(_designPath + "TeamLogo\\POST\\" + dc.RedLiner.TeamName + ".png");
                KAScene.GetObject("B_Team_Box").SetValue(_designPath + "TeamLogo\\POST\\LOSS-TEAM.png");
            }
            //스코어
            KAScene.GetObject("B_Score").SetVisible(1);
            KAScene.GetObject("R_Score").SetVisible(1);

            bScore = scores[0];
            rScore = scores[1];
            bScoreAll = scores[2];
            rScoreAll = scores[3];

            KAScene.GetObject("B_Score").SetValue(bScore);
            KAScene.GetObject("R_Score").SetValue(rScore);

            KAScene.GetObject("BScore").SetVisible(1);
            KAScene.GetObject("RScore").SetVisible(1);
            KAScene.GetObject("BScoreAll").SetVisible(1);
            KAScene.GetObject("RScoreAll").SetVisible(1);
            KAScene.GetObject("BScore").SetValue(bScore);
            KAScene.GetObject("RScore").SetValue(rScore);
            KAScene.GetObject("BScoreAll").SetValue(bScoreAll);
            KAScene.GetObject("RScoreAll").SetValue(rScoreAll);



            //팀명, 로고 
            KAScene.GetObject("B_Team_Name").SetValue(dc.BlueLiner.TeamName);
            KAScene.GetObject("B_Team_Logo").SetValue(RES_FOLDER_PATH + "Team Logo(1080x1080)\\" + dc.BlueLiner.TeamName + ".png");
            KAScene.GetObject("R_Team_Name").SetValue(dc.RedLiner.TeamName);
            KAScene.GetObject("R_Team_Logo").SetValue(RES_FOLDER_PATH + "Team Logo(1080x1080)\\" + dc.RedLiner.TeamName + ".png");

            if (isT1Home)
            {

            }
            else
            {
                KAScene.GetObject("B_Team_Name").SetFaceTextColor(0, dc.BlueLiner.TeamName.Length, 31, 26, 46, 255);
                KAScene.GetObject("R_Team_Name").SetFaceTextColor(0, dc.RedLiner.TeamName.Length, 31, 26, 46, 255);
            }
            

            //타이틀
            KAScene.GetObject("Group").SetValue(titles[0]);
            KAScene.GetObject("Match").SetValue(titles[1]);
            KAScene.GetObject("Version").SetValue(titles[2]);

            //K/D/A
            if (kda수동)
            {
                KAScene.GetObject("B_KDA").SetValue(KDABlue);
                KAScene.GetObject("R_KDA").SetValue(KDARed);
            }
            else
            {
                try
                {
                    int bk = 0; int bd = 0; int ba = 0;
                    int rk = 0; int rd = 0; int ra = 0;
                    foreach (DataRow dr in dts[3].Rows)
                    {
                        if (dr[0].Equals("블루"))
                        {
                            bk += Convert.ToInt32(dr[3]); bd += Convert.ToInt32(dr[4]); ba += Convert.ToInt32(dr[5]);
                        }
                        else
                        {
                            rk += Convert.ToInt32(dr[3]); rd += Convert.ToInt32(dr[4]); ra += Convert.ToInt32(dr[5]);
                        }
                    }
                    //KDA
                    KAScene.GetObject("B_KDA").SetValue(bk.ToString() + "/" + bd.ToString() + "/" + ba.ToString());
                    KAScene.GetObject("R_KDA").SetValue(rk.ToString() + "/" + rd.ToString() + "/" + ra.ToString());
                }
                catch (Exception ex)
                {
                    MessageBox.Show("KDA 정보가 옳바르지 않습니다. 수동 입력을 사용해주세요.");
                    return;
                }
                
            }
            

            //Gold
            KAScene.GetObject("B_Gold").SetValue(String.Format("{0:0.0}", (Convert.ToDouble(dts[7].Rows[dts[7].Rows.Count - 2][0].ToString()) / 1000)) + "K");
            KAScene.GetObject("R_Gold").SetValue(String.Format("{0:0.0}", (Convert.ToDouble(dts[7].Rows[dts[7].Rows.Count - 2][1].ToString()) / 1000)) + "K");

            //타워
            int blueTower = 0; int redTower = 0;
            foreach (DataRow dr in dts[4].Rows)
            {
                if (dr[4].Equals("turret"))
                {
                    if (dr[0].Equals("블루")) blueTower++;
                    else redTower++;
                }
            }
            KAScene.GetObject("R_Towers").SetValue(blueTower.ToString());
            KAScene.GetObject("B_Towers").SetValue(redTower.ToString());

            //오브젝트 - 전령, 용, 장로, 바론
            //[블루, 레드], [전령, 용, 장로, 바론], [획득 오브젝트] 의 형태로 데이터를 넣는다
            string[][][] Objects = new string[2][][];
            for (int i = 0; i < 2; i++)
            {
                Objects[i] = new string[6][];
                Objects[i][0] = new string[] { "", "" };
                Objects[i][1] = new string[] { "", "", "", "" };
                Objects[i][2] = new string[] { "", "", "" };
                Objects[i][3] = new string[] { "", "", "" };
                Objects[i][4] = new string[] { "", "", "", "", "", "" };
                Objects[i][5] = new string[] { "", "" };
            }
            foreach (DataRow dr in dts[5].Rows)
            {
                int BR = dr[2].Equals("블루") ? 0 : 1;
                int sub1 = -1;
                string sub2 = "";

                if (dr[0].Equals("riftHerald"))
                {
                    sub1 = 0; sub2 = "Heralds";
                }
                else if (dr[0].Equals("dragon"))
                {
                    if (dr[1].Equals("elder"))
                    {
                        sub1 = 2; sub2 = "Elders";
                    }
                    else
                    {
                        sub1 = 1; sub2 = "Dragon_" + dr[1];
                    }
                }
                else if (dr[0].Equals("baron"))
                {
                    sub1 = 3; sub2 = "Baron";
                }
                else if (dr[0].Equals("VoidGrub"))
                {
                    //continue;
                    sub1 = 4; sub2 = "Hordes";
                }
                else if (dr[0].ToString().Contains("Atakhan"))
                {
                    sub1 = 5; sub2 = dr[0].ToString();
                }

                if (sub1 != -1)
                {
                    for (int i = 0; i < Objects[BR][sub1].Length; i++)
                    {
                        if (Objects[BR][sub1][i] == "")
                        {
                            Objects[BR][sub1][i] = sub2;
                            break;
                        }
                    }
                }
            }

            void setObjectImg(string fileName, string tagName)
            {
                string imgPath = RES_FOLDER_PATH + @"MonsterRename\" + fileName + ".png";
                if (fileName.Equals(""))
                {
                    KAScene.GetObject(tagName).SetVisible(0);
                }
                else
                {
                    KAScene.GetObject(tagName).SetVisible(1);
                    KAScene.GetObject(tagName).SetValue(imgPath);
                }
            }

            KAScene.GetObject("R_split_line").SetVisible(0);
            KAScene.GetObject("B_split_line").SetVisible(0);

            for (int i = 0; i < 2; i++)
            {
                string BR = i == 0 ? "B" : "R";

                for (int j = 0; j < 6; j++)
                {
                    string sub = "Heralds";
                    if (j == 1) sub = "Drakes";
                    else if (j == 2) sub = "Elders";
                    else if (j == 3) sub = "Barons";
                    else if (j == 4) sub = "Hordes";
                    else if (j == 5) sub = "Atakhan";

                    for (int k = 0; k < Objects[i][j].Length; k++)
                    {
                        setObjectImg(Objects[i][j][k], BR + "_" + sub + "_" + (k + 1));

                        if (j == 5)
                        {
                            if (Objects[i][j][k] != "")
                            {
                                if (BR == "B") KAScene.GetObject("B_split_line").SetVisible(1);
                                else KAScene.GetObject("R_split_line").SetVisible(1);
                            }                           
                        }
                    }
                }
            }


            //골드 그래프
            //{ time.ToString(), row.ToString(), max.ToString(), min.ToString(), path };
            time = Convert.ToInt32(ForResultGold[0]);
            double max = Convert.ToDouble(ForResultGold[2]);
            double min = Convert.ToDouble(ForResultGold[3]);
            string path = ForResultGold[4];

            string d_min = (min / 1000).ToString("##0.0");

            if (d_min != "")
            {
                if (d_min.Substring(0, 1) == "-")
                    d_min = d_min.Substring(1);

                KAScene.GetObject("Min").SetValue(d_min + "K");
                KAScene.GetObject("Max").SetValue((max / 1000).ToString("##0.0") + "K");
                KAScene.GetObject("Graph").SetValue(path);


                KAScene.GetObject("t4").SetValue((time / 60).ToString());

                time = ((time / 4) / 60);

                for (int i = 1; i <= 3; i++)
                {
                    KAScene.GetObject("t" + i.ToString()).SetValue((time * i).ToString());
                }

            }

            //딜량
            string[][] blue = new string[5][];
            string[][] red = new string[5][];
            string getChampsPath(string fileName) => RES_FOLDER_PATH + @"Champs(140x140)\" + fileName + "_140140.png";


            //벤픽 사진
            KAScene.GetObject("Ban1").SetValue(getChampsPath(dc.BlueLiner.Top.ban));
            KAScene.GetObject("Ban3").SetValue(getChampsPath(dc.BlueLiner.Jungle.ban));
            KAScene.GetObject("Ban5").SetValue(getChampsPath(dc.BlueLiner.Mid.ban));
            KAScene.GetObject("Ban8").SetValue(getChampsPath(dc.BlueLiner.ADCarry.ban));
            KAScene.GetObject("Ban10").SetValue(getChampsPath(dc.BlueLiner.Supporter.ban));
            KAScene.GetObject("Ban2").SetValue(getChampsPath(dc.RedLiner.Top.ban));
            KAScene.GetObject("Ban4").SetValue(getChampsPath(dc.RedLiner.Jungle.ban));
            KAScene.GetObject("Ban6").SetValue(getChampsPath(dc.RedLiner.Mid.ban));
            KAScene.GetObject("Ban7").SetValue(getChampsPath(dc.RedLiner.ADCarry.ban));
            KAScene.GetObject("Ban9").SetValue(getChampsPath(dc.RedLiner.Supporter.ban));

            foreach (DataRow dr in dts[1].Rows)
            {
                if (dc.BlueLiner.Top.champ.Equals(dr[2])) blue[0] = new string[] { dr[2].ToString(), dr[3].ToString(), dr[4].ToString() };
                else if (dc.BlueLiner.Jungle.champ.Equals(dr[2])) blue[1] = new string[] { dr[2].ToString(), dr[3].ToString(), dr[4].ToString() };
                else if (dc.BlueLiner.Mid.champ.Equals(dr[2])) blue[2] = new string[] { dr[2].ToString(), dr[3].ToString(), dr[4].ToString() };
                else if (dc.BlueLiner.ADCarry.champ.Equals(dr[2])) blue[3] = new string[] { dr[2].ToString(), dr[3].ToString(), dr[4].ToString() };
                else if (dc.BlueLiner.Supporter.champ.Equals(dr[2])) blue[4] = new string[] { dr[2].ToString(), dr[3].ToString(), dr[4].ToString() };

                else if (dc.RedLiner.Top.champ.Equals(dr[2])) red[0] = new string[] { dr[2].ToString(), dr[3].ToString(), dr[4].ToString() };
                else if (dc.RedLiner.Jungle.champ.Equals(dr[2])) red[1] = new string[] { dr[2].ToString(), dr[3].ToString(), dr[4].ToString() };
                else if (dc.RedLiner.Mid.champ.Equals(dr[2])) red[2] = new string[] { dr[2].ToString(), dr[3].ToString(), dr[4].ToString() };
                else if (dc.RedLiner.ADCarry.champ.Equals(dr[2])) red[3] = new string[] { dr[2].ToString(), dr[3].ToString(), dr[4].ToString() };
                else if (dc.RedLiner.Supporter.champ.Equals(dr[2])) red[4] = new string[] { dr[2].ToString(), dr[3].ToString(), dr[4].ToString() };
            }

            bool isError = false;

            for (int i = 0; i < 5; i++)
            {
                if (blue[i] != null && red[i] != null)
                {
                    KAScene.GetObject("B_Player" + (i + 1) + "_GoldBar").SetSize(Convert.ToInt32((Convert.ToDouble(blue[i][2]) * 3.6)), 16, 100);
                    KAScene.GetObject("B_Player" + (i + 1) + "_GoldBar").SetPosition((-360 + Convert.ToInt32((Convert.ToDouble(blue[i][2]) * 3.6)) / 2), 88, 0, eKVectorType.VECTOR_TYPE_X);

                    KAScene.GetObject("R_Player" + (i + 1) + "_GoldBar").SetSize(Convert.ToInt32((Convert.ToDouble(red[i][2]) * 3.6)), 16, 100);
                    KAScene.GetObject("R_Player" + (i + 1) + "_GoldBar").SetPosition((360 - Convert.ToInt32((Convert.ToDouble(red[i][2]) * 3.6)) / 2), 88, 0, eKVectorType.VECTOR_TYPE_X);

                    if (isT1Home)
                    {
                        KAScene.GetObject("R_Player" + (i + 1) + "_GoldBar").SetFaceColor(redC.R, redC.G, redC.B, 255);
                        KAScene.GetObject("B_Player" + (i + 1) + "_GoldBar").SetFaceColor(blueC.R, blueC.G, blueC.B, 255);
                    }
                    else
                    {
                        KAScene.GetObject("R_Player" + (i + 1) + "_GoldBar").SetFaceColor(255, 47, 79, 255);
                        KAScene.GetObject("B_Player" + (i + 1) + "_GoldBar").SetFaceColor(55, 73, 235, 255);


                    }

                    KAScene.GetObject("B_Player" + (i + 1) + "_Gold").SetValue(Convert.ToDouble(blue[i][1]).ToString("0"));
                    KAScene.GetObject("R_Player" + (i + 1) + "_Gold").SetValue(Convert.ToDouble(red[i][1]).ToString("0"));

                    KAScene.GetObject("B_Player" + (i + 1) + " Image").SetValue(getChampsPath(blue[i][0]));
                    KAScene.GetObject("R_Player" + (i + 1) + " Image").SetValue(getChampsPath(red[i][0]));
                }
                else
                {

                    KAScene.GetObject("B_Player" + (i + 1) + "_GoldBar").SetSize(Convert.ToInt32((Convert.ToDouble(0) * 3.6)), 16, 100);
                    KAScene.GetObject("R_Player" + (i + 1) + "_GoldBar").SetSize(Convert.ToInt32((Convert.ToDouble(0) * 3.6)), 16, 100);
                    KAScene.GetObject("B_Player" + (i + 1) + "_Gold").SetValue("");
                    KAScene.GetObject("R_Player" + (i + 1) + "_Gold").SetValue("");
                    KAScene.GetObject("B_Player" + (i + 1) + " Image").SetValue("");
                    KAScene.GetObject("R_Player" + (i + 1) + " Image").SetValue("");

                    isError = true;
                }
            }
             

            KAScene.AddPause(0, 80, 0, 0);
            Prepare(mainLayer);
            Play(mainLayer);
        }

        #endregion


        #region POG

        public string GetChampName(string name)
        {
            name = name.ToUpper();

            if (name == "AURELIONSOL")
                name = "AURELION SOL";
            else if (name == "CHOGATH")
                name = "CHO'GATH";
            else if (name == "DRMUNDO")
                name = "DR. MUNDO";
            else if (name == "JARVANIV")
                name = "JARVAN IV";
            else if (name == "KAISA")
                name = "KAI'SA";
            else if (name == "KHAZIX")
                name = "KHA'ZIX";
            else if (name == "KOGMAW")
                name = "KOG'MAW";
            else if (name == "LEESIN")
                name = "LEE SIN";
            else if (name == "MASTERYI")
                name = "MASTER YI";
            else if (name == "MISSFORTUNE")
                name = "MISS FORTUNE";
            else if (name == "NUNU")
                name = "NUNU & WILLUMP";
            else if (name == "REKSAI")
                name = "REK'SAI";
            else if (name == "TAHMKENCH")
                name = "TAHM KENCH";
            else if (name == "VELKOZ")
                name = "VEL'KOZ";
            else if (name == "XINZHAO")
                name = "XIN ZHAO";
            else if (name == "MONKEYKING")
                name = "WUKONG";
            else if (name == "TWISTEDFATE")
                name = "TWISTED FATE";
            else if (name == "KSANTE")
                name = "K'SANTE";
            else if (name == "RENATA")
                name = "RENATA GLASC";
            else if (name == "BELVETH")
                name = "BEL'VETH";
            return name;
        }

        public void DisplayPOG(List<string[]> data, string points, string team, string line, string champ, string player, bool isBlue, bool isPreView, string previewPath, string logoTag, string round)
        {
            LoadScene(sceneNamePOG);

            string BR = isBlue ? "B" : "R";
            KAScene.GetObject("back").SetValue(_designPath + @"Images\POG_" + BR + ".png");

            //KAScene.GetObject("Game").SetValue("GAME " + round);

            //선수사진
            KAScene.GetObject("MVP_Player_Image").SetValue(_designPath + "TeamLogo\\POG\\" + team + "\\" + player + ".png"); //선수사진                                                                                                                                                     
            KAScene.GetObject("MVP_Player_Name").SetValue(player);
            //KAScene.GetObject("MVP_Player_Name").SetFaceTextColor(0, player.Length, 31, 26, 46, 255);
            //팀로고
            //KAScene.GetObject("MVP_Team_Logo").SetValue(RES_FOLDER_PATH + "TeamLogo_W\\" + team + ".png");
            KAScene.GetObject("MVP_Team_Logo").SetValue(RES_FOLDER_PATH + "Team Logo POG\\" + team + "_" + logoTag + ".png");
            //챔프이미지
            KAScene.GetObject("MVP_Champion_Image").SetValue(RES_FOLDER_PATH + @"Champs(620x130)\" + champ + "_L.png");

            //
            SetValue("MVP_Player_Points", points);
            //챔프이름
            //KAScene.GetObject("Champ Name").SetValue(GetChampName(champ.ToUpper()));
            //KAScene.GetObject("Champ Name").SetFaceTextColor(0, GetChampName(champ.ToUpper()).Length, 255, 255, 255, 255);

            //라인이미지
            KAScene.GetObject("MVP_Position").SetValue(RES_FOLDER_PATH + "Position\\" + line + "_LCK-B(500x500).png");


            string imgPath(string fileName) => RES_FOLDER_PATH + @"Champs(520x370)\" + fileName + "_L.png";

            //각 게임별 정보
            for (int i = 1; i < 6; i++)
            {
                //보여지기
                SetVisible("Game" + i + "_Group", Convert.ToBoolean(data[i - 1][0]));
                //결과
                SetValue("Game" + i + "_Result", data[i - 1][1].ToString());
                //챔피언
                string ichamp = data[i - 1][2].ToString();
                SetValue("Game" + i + "_Champ_Name", GetChampName(ichamp));
                SetValue("Game" + i + "_Champ_Img", imgPath(ichamp));
                //KDA
                SetValue("Game" + i + "_Stats", data[i - 1][3].ToString());
                SetValue("Game" + i + "_Text", data[i - 1][4].ToString());
            }

            if (isPreView)
            {
                KAScene.DownloadThumbnail(previewPath, 640, 480, 60);
            }
            else
            {
                Prepare(mainLayer);
                Play(mainLayer);
            }
        }

        #endregion

        

        #endregion


        #endregion


    }
}
