public bool Download()
    {
        if (m_TbWWW == null)
        {
            m_TbWWW = _instance.gameObject.AddComponent <TableWWW>();
        }

        if (m_mapDownloadList.Count == 0 ||
            (m_mapDownloadList.Count + 1) != m_nSuccessCount)
        {
            m_mapDownloadList.Clear();


            AddTable <TbDataIO <TowerTb> >(eTable.Tower,
                                           (a_bSuccess) =>
            {
                ++m_nDownloadCount;

                if (a_bSuccess == true)
                {
                    Debug.LogError("success");
                    ++m_nSuccessCount;

                    var li = TbDataIO <TowerTb> .m_liTb;

                    for (int i = 0; i < li.Count; ++i)
                    {
                        Table <string, TowerTb> .SetTb(li[i].towerName, li[i]);
                    }
                }
            }
                                           ,
                                           (strReadLine) =>
            {
                TowerTb towerBase = new TowerTb(strReadLine.Split(','));
                Table <string, TowerTb> .SetTb(towerBase.towerName, towerBase);
            }
                                           );

            //SpawnTowerTb

            AddTable <TbDataIO <SpawnTowerTb> >(eTable.SpawnTower,
                                                (a_bSuccess) =>
            {
                ++m_nDownloadCount;

                if (a_bSuccess == true)
                {
                    Debug.LogError("success");
                    ++m_nSuccessCount;

                    var li = TbDataIO <SpawnTowerTb> .m_liTb;

                    for (int i = 0; i < li.Count; ++i)
                    {
                        Table <int, SpawnTowerTb> .SetTb(li[i].upgradeLevel, li[i]);
                    }
                }
            },
                                                (strReadLine) =>
            {
                SpawnTowerTb spawnBase = new SpawnTowerTb(strReadLine.Split(','));
                Table <int, SpawnTowerTb> .SetTb(spawnBase.upgradeLevel, spawnBase);
            });



            //MonsterTable
            AddTable <TbDataIO <MonsterTb> >(eTable.Monster,
                                             (a_bSuccess) =>
            {
                ++m_nDownloadCount;

                if (a_bSuccess == true)
                {
                    Debug.LogError("success");
                    ++m_nSuccessCount;

                    var li = TbDataIO <MonsterTb> .m_liTb;

                    for (int i = 0; i < li.Count; ++i)
                    {
                        Table <MonsterId, MonsterTb> .SetTb(li[i].id, li[i]);
                    }
                }
            },
                                             (strReadLine) =>
            {
                MonsterTb monsterBase = new MonsterTb(strReadLine.Split(','));
                Table <MonsterId, MonsterTb> .SetTb((MonsterId)monsterBase.id, monsterBase);
            });



            // Download Start ----------------------------------------------------------------
            StartCoroutine(Down());
            return(true);
        }

        return(false);
    }
Пример #2
0
 public void LocalReq(System.Action <bool> a_refCallback)
 {
     TableWWW.LocalReq <TB>(int.Parse(typeof(TB).TableDescription()), m_liTb, a_refCallback);
 }
Пример #3
0
 public void LocalReq(string sKey, eTable eVal, Action <bool> a_refCallback)
 {
     TableWWW.LocalReq <Tb>(sKey, int.Parse(eVal.ToDesc()), m_liTable, a_refCallback);
 }
Пример #4
0
 public void Req(TableWWW a_refTb, System.Action <bool> a_refCallback)
 {
     a_refTb.Req <TB>(int.Parse(typeof(TB).TableDescription()), m_liTb, a_refCallback);
 }
Пример #5
0
 public void Req(string sKey, eTable eVal, TableWWW a_refWWW, Action <bool> a_refCallback)
 {
     a_refWWW.Req <Tb>(sKey, int.Parse(eVal.ToDesc()), m_liTable, a_refCallback);
 }