Example #1
0
    public void OnBuy(string code)
    {
        if (!PermitChoose)
        {
            return;
        }
        for (int i = 0; i < listElement.Length; i++)
        {
            Element a = listElement[i];
            if (a.codeName == code)
            {
                if (listElement[i].chest != null)
                {
                    Notification.ReMind(Languages.getString("BanDaMuaLoaiRuongNayRoi"));
                    return;
                }
                ColorChest c = ColorChest.Copper;
                TypeChest  t = TypeChest.WeaponCopper;
                switch (listElement[i].codeName)
                {
                case "RuongDong":
                    c = ColorChest.Copper;
                    t = TypeChest.WeaponCopper;
                    break;

                case "RuongBac":
                    c = ColorChest.Silver;
                    t = TypeChest.WeaponSilver;
                    break;

                case "RuongVang":
                    c = ColorChest.Gold;
                    t = TypeChest.WeaponGold;
                    break;
                }
                if (!Personal.TryToSubDOLA(a.price))
                {
                    Notification.ReMind(Languages.getString("MuaThatBai"));
                    break;
                }
                a.chest = ChestManager.SpawnStartChest(c, t, CodeMap.Map1, a.positionSpawn.position);
                if (a.chest != null)
                {
                }
                else
                {
                    Notification.NoticeBelow(Languages.getString("CoLoiXayRaVoiHanhDongNay"));
                }
                break;
            }
        }
        PermitChoose = false;
        DeShow();
    }
Example #2
0
    public static Chest SpawnReWardChest(ColorChest color, TypeChest type, Vector3 Position)
    {
        ChestData cdt = getDataChest(type, MAP_GamePlay.CodeMapcurent);

        if (cdt == null)
        {
            Debug.Log("Không tìm thấy ChestData type = " + type);
            return(null);
        }
        Chest cpf = getChestPrefab(color);

        if (cpf == null)
        {
            Debug.Log("Không tìm thấy Prefabs Chest Colortype = " + color);
            return(null);
        }
        Chest chest = GameObject.Instantiate(cpf, Position, Quaternion.identity);

        chest.SetUpData(cdt);
        return(chest);
    }
Example #3
0
 public static ChestData getDataChest(TypeChest type, CodeMap codemap)
 {
     return(Array.Find(ChestDatas, e => e.Type == type && e.codeMap == codemap));
 }
Example #4
0
 public void SetUpData(ChestData Data)
 {
     this.Data = Data;
     type      = Data.Type;
 }