Example #1
0
 public void GetInfoJson(GoldMineInfoST gInfo)
 {
     info.ID      = gInfo.ID;
     info.name    = gInfo.name;
     txtName.text = gInfo.name;
     info.level   = gInfo.level;
     SetInfo(gInfo.level);
     SetLevel(gInfo.level);
     info.typeGoleMine      = gInfo.isPlayer ? TypeGoldMine.Player : TypeGoldMine.Enemy;
     info.indexLoadGoldMine = gInfo.indexLoadGoldMine;
     SetSpriteBox(GameManager.Instance.maxLevelHouse);
     foreach (HeroInfoST hInfo in gInfo.lsHeroGoldMine)
     {
         if (gInfo.isPlayer)
         {
             InstantiateHeroJson(hInfo.ID, hInfo.CountHero);
         }
         else
         {
             InstantiateEnemyJson(hInfo.ID, hInfo.CountHero);
         }
     }
 }
 public void GenerateMapJson(Transform toPos, Box box, int typeGoldMine, Vector3 _rotation, GoldMineInfoST gInfo, bool isGoldPlayer = false)
 {
     if (isGoldPlayer)
     {
         _rotation = new Vector3(0, 0, 0);
         GoldMine goldMine = Instantiate(prefabsBoxMap[2], toPos.position, Quaternion.Euler(_rotation), toPos).GetComponent <GoldMine>();
         goldMine.GetInfoJson(gInfo);
         goldMine.canvas.localRotation = Quaternion.Euler(_rotation);
         lsGoldMinePlayer.Add(goldMine);
         lsGoldMineManager.Add(goldMine);
         box.info.goldMine = goldMine;
     }
     else
     {
         GoldMine goldMine = Instantiate(prefabsBoxMap[typeGoldMine], toPos.position, Quaternion.Euler(_rotation), toPos).GetComponent <GoldMine>();
         goldMine.GetInfoJson(gInfo);
         goldMine.canvas.localRotation = Quaternion.Euler(_rotation);
         lsGoldMineEnemy.Add(goldMine);
         lsGoldMineManager.Add(goldMine);
         box.info.goldMine = goldMine;
     }
 }