public void miniSet(CharacterStatus cs, int id, int userLevel, bool bPlayLevelUpAnim = true)
    {
        // upgrade 버튼 누르면 refresh.
        Debug.Log("miniSET : called  " + id);
        LevelData leveldata = null;
        LevelData leveldataNow = null;
        int befLevel = (int) cs.My_Level-1;
        DataManager.Get().LevelDatas.TryGetValue(CharacterStatus.GetLevelDataIndex(cs.index, befLevel), out leveldataNow);
        

        if (!GameManager.CharacterInfo[id].charon)
        {
            DataManager.Get().LevelDatas.TryGetValue(cs.GetLevelDataIndex(), out leveldata);
            GameManager.CharacterInfo[id].My_Gold = leveldata.Gold;
        }
        else
        {
            
            if (cs.My_Level == 60)
            {
                GameManager.CharacterInfo[id].My_Gold = 0;
                DataManager.Get().LevelDatas.TryGetValue(cs.GetLevelDataIndex(), out leveldata);
            }
            else if ((cs.My_Level % 20) == 0)
            {
                DataManager.Get().LevelDatas.TryGetValue(cs.GetLevelDataIndex() + 101, out leveldata);
                GameManager.CharacterInfo[id].My_Gold = leveldata.Gold;
            }
            else
            {
                DataManager.Get().LevelDatas.TryGetValue(cs.GetLevelDataIndex() + 1, out leveldata);
                GameManager.CharacterInfo[id].My_Gold = leveldata.Gold;
            }
        }

        HpUp.text = "+" +((int)(cs.getHPWithoutAccountBonus() - currhp)).ToString();
        float befAtkValue = leveldataNow.AttackPoint * (1f + (userLevel*0.003f));
        int attackPointUpValue = (int) cs.char_ATK - (int) befAtkValue;
        if (0 < attackPointUpValue)
        {
            AttackPointUp.text = "+" + attackPointUpValue.ToString();
        }
        else
        {
            AttackPointUp.text = string.Empty;
        }

        BulletData befBulletData = CharacterStatus.GetBulletDataIndex(cs.index, befLevel);
        float attackSpeedUpValue = 0.0f;
        if (befBulletData != null)
        {
            attackSpeedUpValue = cs.shooting_delay - befBulletData.Delay;
        }
        if (attackSpeedUpValue !=  0.0f)
        {
            if (0.0f < attackSpeedUpValue)
            {
                AttackSpeedUp.text = "+" + attackSpeedUpValue.ToString();
            }
            else
            {
                AttackSpeedUp.text = attackSpeedUpValue.ToString();
            }
            
        }
        else
        {
            AttackSpeedUp.text = string.Empty;
        }
        Hp.text = cs.getHPWithoutAccountBonus().ToString();
        AttackPoint.text = cs.getATKWithoutAccountBonus().ToString();
        AttackSpeed.text = cs.shooting_delay.ToString();
        currhp = cs.getHPWithoutAccountBonus();
        
        CurrLevel.text = cs.My_Level.ToString();
        LevelUpGold.text = GameManager.CharacterInfo[id].My_Gold.ToString();
        minisprite.spriteName = cs.char_name + "_idle_01";
        mininame = minisprite.spriteName;
        miniBullet.spriteName = cs.char_name;
        settraintext((int)cs.My_Level, cs.charon);

        StopCoroutine("upStatanim");
        StopCoroutine("upanim");

        if (bPlayLevelUpAnim == true)
        {
            StartCoroutine("upanim");
        }
        else
        {
            StartCoroutine("upStatanim");
        }
    }
    public void SetData(CharacterStatus cs, int id)
    {
        // 승급시는 이것만...
        //Debug.Log("SETDATAA : called");
        if(!GameManager.CharacterInfo[id].charon)
        {
            LevelData leveldata;
            DataManager.Get().LevelDatas.TryGetValue(cs.GetLevelDataIndex(), out leveldata);
            if (leveldata == null)
            {
                MessageBox.Show("Error", "An error has occurred(0x0000), Please,  Re-connect it", true, () =>
                {
                    GameManager.ApplicationQuit();
                });
                return;
            }
            GameManager.CharacterInfo[id].My_Gold = leveldata.Gold;
        }
        else
        {
            LevelData leveldata;
            if ((cs.My_Level) == 60)
            {
                GameManager.CharacterInfo[id].My_Gold = 0;
            }
            else if ((cs.My_Level % 20) == 0)
            {
                DataManager.Get().LevelDatas.TryGetValue(cs.GetLevelDataIndex() + 101, out leveldata);
                if (leveldata == null)
                {
                    MessageBox.Show("Error", "An error has occurred(0x0001), Please,  Re-connect it", true, () =>
                    {
                        GameManager.ApplicationQuit();
                    });
                    return;
                }
                GameManager.CharacterInfo[id].My_Gold = leveldata.Gold;
            }
            else
            {
                DataManager.Get().LevelDatas.TryGetValue(cs.GetLevelDataIndex() + 1, out leveldata);
                if (leveldata == null)
                {
                    MessageBox.Show("Error", "An error has occurred(0x0002), Please,  Re-connect it", true, () =>
                    {
                        GameManager.ApplicationQuit();
                    });
                    return;
                }
                GameManager.CharacterInfo[id].My_Gold = leveldata.Gold;
            }
        }

        stringid = id;
        AttackPoint.text = cs.getATKWithoutAccountBonus().ToString();
        AttackSpeed.text = cs.shooting_delay.ToString();
        chainpanel.SetActive(false);
        currhp = cs.getHPWithoutAccountBonus();
        currdps = (int)cs.getATKWithoutAccountBonus();//(cs.char_ATK * ((cs.shooting_amount * cs.shooting_repeat) / cs.shooting_period));
        Gradeup.GetComponent<GradeUpButton>().id = cs.index -1;
        
        miniBullet.spriteName = cs.char_name;
        minisprite.spriteName = cs.char_name + "_idle_01";
        mininame = minisprite.spriteName;
        SetAttackStyleLabel(cs.char_name);

        settraintext((int)cs.My_Level, cs.charon);
        main_illust.atlas = GameObject.Find("GameManager").GetComponent<GameManager>().CharAtlas[cs.index-1];

        main_illust.spriteName = cs.char_name;
        
        Setattribute(cs);
        MaxLevel.text = (cs.My_Grade * 20).ToString();
        Name.text = cs.char_hanname;
        LevelUpGold.text = GameManager.CharacterInfo[id].My_Gold.ToString();
        if(cs.charon)
        {
            sbutton.SetActive(true);
            gradeupbutton.transform.position = gradeuporipos;
            Hp.text = ((int)cs.getHPWithoutAccountBonus()).ToString();
            //Dps.text = (300 + (16 * (cs.My_Level - 1))).ToString();

            int atk = (int)cs.getATKWithoutAccountBonus();
            AttackPoint.text = atk.ToString();
            //Debug.Log("DPS 1: " + atk );

            Mana.text = cs.char_MP.ToString();
            ActiveSkill.text = cs.Askill_name;
            CurrLevel.text = cs.My_Level.ToString();
            MaxLevel.text = (cs.My_Grade * 20).ToString();
            main_illust.color = Color.white;
            for (int i = 0; i < 4; i++)
            {
                border[i].color = Color.white;
            }
            storyb.color = Color.white;
            level.color = Color.white;
            skillinfo.color = Color.white;
            info.color = Color.white;
            //preview.color = Color.white;
            ATKStyle.color = Color.white;
            namec.color = Color.white;
            minisprite.color = Color.white;
            miniBullet.color = Color.white;
        }
        else
        {
            sbutton.SetActive(false);
            chainpanel.SetActive(true);
            for (int i = 0; i < 4; i++)
            {
                chain[i].GetComponent<Animator>().speed = 1.0f;
            }
            gradeupbutton.transform.position = new Vector3(0, -0.07f, 0);
            Hp.text = string.Empty;
            AttackPoint.text = string.Empty;
            AttackSpeed.text = string.Empty;
            Mana.text = string.Empty;
            ActiveSkill.text = string.Empty;
            CurrLevel.text = string.Empty;
            MaxLevel.text = string.Empty;
            main_illust.color = Color.gray;
            for (int i = 0; i < 4; i++)
            {
                border[i].color = Color.gray;
            }
            storyb.color = Color.gray;
            level.color = Color.gray;
            skillinfo.color = Color.gray;
            info.color = Color.gray;
            //preview.color = Color.gray;
            ATKStyle.color = Color.gray;
            namec.color = Color.gray;
            minisprite.color = Color.gray;
            miniBullet.color = Color.gray;
        }
    }
 public void purchaseSet(CharacterStatus cs, int id)
 {
     Debug.Log("PUCHASE_SET : called");
     if (!GameManager.CharacterInfo[id].charon)
     {
         LevelData leveldata;
         DataManager.Get().LevelDatas.TryGetValue(cs.GetLevelDataIndex(), out leveldata);
         GameManager.CharacterInfo[id].My_Gold = leveldata.Gold;
     }
     else
     {
         LevelData leveldata;
         if (cs.My_Level == 60)
         {
             GameManager.CharacterInfo[id].My_Gold = 0;
         }
         else if ((cs.My_Level % 20) == 0)
         {
             DataManager.Get().LevelDatas.TryGetValue(cs.GetLevelDataIndex() + 101, out leveldata);
             GameManager.CharacterInfo[id].My_Gold = leveldata.Gold;
         }
         else
         {
             DataManager.Get().LevelDatas.TryGetValue(cs.GetLevelDataIndex() + 1, out leveldata);
             GameManager.CharacterInfo[id].My_Gold = leveldata.Gold;
         }
     }
     purcs = GameManager.CharacterInfo[id];
     purid = id;
     StartCoroutine(purchaseanim());
     
     sbutton.SetActive(true);
    
 }