Ejemplo n.º 1
0
    void LoadData()
    {
        if (_HeroType == E_HeroType.main)
        {
            _slot_no = 1;
        }
        ST_S_unit_invenRec saveUnit = new ST_S_unit_invenRec();

        saveUnit = DataManager.Instance._SqlSavedata_unit_inven.Get_All_From_slot_no(_slot_no);
        if (saveUnit.idx > 0)
        {
            GameObject prefab = GameWorld.Instance._UnitList.GetPrefab_Unit(saveUnit.unit_code);
            if (prefab)
            {
                GameObject childObj = (GameObject)Instantiate(prefab);
                if (_HeroType == E_HeroType.sub && _JointRoot != null)
                {
                    _JointRoot.parent         = null;
                    childObj.transform.parent = _JointRoot;
                }
                else
                {
                    childObj.transform.parent = this.transform;
                }

                childObj.transform.localPosition = new Vector3(0f, 0f, 0f);
                childObj.transform.localScale    = new Vector3(1f, 1f, 1f);
                _UnitRoot = childObj.transform;

                _UnitInfo      = _UnitRoot.GetComponentInChildren <UnitInfo>();
                _AniController = _UnitRoot.GetComponentInChildren <wt_AnimationController>();

                _UnitInfo._Table_idx = saveUnit.idx;
                _UnitInfo._unit_code = saveUnit.unit_code;
                _UnitInfo._ClassNo   = saveUnit.class_no;
                _UnitInfo._Level     = DataManager.Instance.GetUnitLevel(_UnitInfo._Table_idx.ToString(), _UnitInfo._ClassNo);
                _UnitInfo._TotalExp  = DataManager.Instance._SqlSavedata_unit_inven.Get_total_exp(_UnitInfo._Table_idx.ToString());

                _FireType = _UnitInfo._FireType;
            }
            else
            {
                NGUIDebug.Log("Error LoadData() -- GetPrefab_Unit");
            }
        }
        else
        {
            NGUIDebug.Log("Error LoadData() 1");
        }

        ST_B_UnitRec balanceUnit = new ST_B_UnitRec();

        balanceUnit = DataManager.Instance._SqlBalance_unit.Get_UnitRec(_UnitInfo._unit_code, _UnitInfo._Level, _UnitInfo._ClassNo);
        if (balanceUnit.class_no > 0)
        {
            _UnitInfo._HP_Default = _UnitInfo._HP = balanceUnit.hp;
            _UnitInfo._Attack     = balanceUnit.attack;
        }
        else
        {
            Debug.Log("Error LoadData() 2-->" + "," + _UnitInfo._unit_code + "," + _UnitInfo._Level + "," + _UnitInfo._ClassNo);
        }

        if (_HeroType == E_HeroType.sub)
        {
            /* 타입별로 포지션 정해지게끔 수정 함.
             *         Vector2 pos = DataManager.Instance.Get_pos_slot(_slot_no);
             *         this.transform.localPosition = pos;
             *         Collider2D col = GetComponentInChildren <Collider2D>();
             *         if(col)
             *         {
             *             Debug.Log("~~~~~~~ " + col.gameObject.name);
             *             col.enabled = true;
             *         }
             * */
        }
    }