Пример #1
0
    IEnumerator IE_StartData()
    {
        while (true)
        {
            if (DataManager.Instance != null)
            {
                if (DataManager.Instance._SetupDataManager)
                {
                    if (DataManager.Instance._SetupDataManager._SetupOK == true)
                    {
                        break;
                    }
                }
                else
                {
                    Debug.Log("~~~~~~~~~~~~~~~~ DataManager.Instance._SetupDataManager == null !");
                    yield return(new WaitForSeconds(1f));
                }
            }
            yield return(new WaitForFixedUpdate());
        }

        ST_S_unit_invenRec rec    = DataManager.Instance._SqlSavedata_unit_inven.Get_All_From_slot_no(_SloitNo);
        GameObject         prefab = GameWorld.Instance._UnitList.GetPrefab_Unit(rec.unit_code);

        if (prefab)
        {
            GameObject childObj = (GameObject)Instantiate(prefab);
            childObj.transform.parent        = this.transform;
            childObj.transform.localPosition = new Vector3(0f, 0f, 0f);
            childObj.transform.localScale    = new Vector3(1f, 1f, 1f);
        }
    }
Пример #2
0
    public ST_S_unit_invenRec Get_All_From_slot_no(int a_slot_no)
    {
        if (_db == null)
        {
            _db = new SQLiteDB();
        }

        ST_S_unit_invenRec rtn = new ST_S_unit_invenRec();

        string filename = GetFileName_DB();

        try
        {
            _db.Open(filename);

            SQLiteQuery qr;
            string      strsql = string.Format(_querySelect_all_from_slot_no, a_slot_no); // _querySelect_exp
            qr = new SQLiteQuery(_db, strsql);
            while (qr.Step())
            {
                try
                {
                    rtn.idx       = qr.GetInteger("idx");
                    rtn.slot_no   = qr.GetInteger("slot_no");
                    rtn.total_exp = qr.GetInteger("total_exp");
                    rtn.unit_code = qr.GetString("unit_code");
                    rtn.class_no  = qr.GetInteger("class_no");
                }
                catch
                {
                }
            }
            qr.Release();
            _db.Close();
        }
        catch (Exception e)
        {
            if (_db != null)
            {
                _db.Close();
            }
            UnityEngine.Debug.LogError(e.ToString());
        }

        return(rtn);
    }
Пример #3
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;
             *         }
             * */
        }
    }