示例#1
0
    public void RefreshUnLock()
    {
        foreach (var tabWeaponRecord in TableReader.Weapon.Records.Values)
        {
            if (StageDataPack.Instance.CurIdx < tabWeaponRecord.UnLockLevel)
            //if (200 < tabWeaponRecord.UnLockLevel)
            {
                continue;
            }

            if (string.IsNullOrEmpty(_SelectedWeapon))
            {
                _SelectedWeapon = tabWeaponRecord.Id;
            }

            var findItem = GetWeaponItem(tabWeaponRecord.Id);
            if (findItem != null)
            {
                continue;
            }

            WeaponDataItem weaponItem = new WeaponDataItem();
            weaponItem.ItemDataID = tabWeaponRecord.Id;
            weaponItem.Level      = 0;
            if (weaponItem.WeaponRecord.Price == 0)
            {
                weaponItem.Level = 1;
            }
            _UnLockWeapons.Add(weaponItem);
        }

        UIMainFun.ShowRedTip();
    }
示例#2
0
    public static void ShowAsyn(WeaponDataItem weaponItem)
    {
        Hashtable hash = new Hashtable();

        hash.Add("WeaponItem", weaponItem);
        GameCore.Instance.UIManager.ShowUI(UIConfig.UIWeaponSkillTip, UILayer.SubPopUI, hash);
    }
示例#3
0
    public void BuyWeaponHandle(object e, Hashtable hash)
    {
        Debug.Log("BuyWeaponHandle");
        WeaponDataItem weaponItem       = (WeaponDataItem)hash["WeaponItem"];
        Dictionary <string, object> dic = new Dictionary <string, object>();

        dic.Add("WeaponID", weaponItem.ItemDataID);
        TalkingDataGA.OnEvent("BuyWeapon", dic);
    }
示例#4
0
    public override void Show(Hashtable hash)
    {
        base.Show(hash);

        var weaponItem = (WeaponDataItem)hash["InitObj"];

        _ShowWeapon = weaponItem;
        RefreshWeaponItem(weaponItem);
    }
示例#5
0
    public static void SetSelectWeapon(WeaponDataItem chooseWeapon)
    {
        var instance = GameCore.Instance.UIManager.GetUIInstance <UIChangeWeapon>(UIConfig.UIChangeWeapon);

        if (instance == null)
        {
            return;
        }

        if (!instance.isActiveAndEnabled)
        {
            return;
        }

        instance.OnChooseWeapon(chooseWeapon);
    }
示例#6
0
    public void BuyWeapon(WeaponDataItem weaponItem)
    {
        if (weaponItem.Level > 0)
        {
            return;
        }

        if (PlayerDataPack.Instance.DecMoney(PlayerDataPack.MoneyGold, weaponItem.WeaponRecord.Price))
        {
            weaponItem.Level = 1;
            SaveClass(true);
        }

        Hashtable hash = new Hashtable();

        hash.Add("WeaponItem", weaponItem);
        GameCore.Instance.EventController.PushEvent(EVENT_TYPE.EVENT_LOGIC_BUY_WEAPON, this, hash);
    }
示例#7
0
    public void LvUpWeapon(WeaponDataItem weaponItem)
    {
        if (weaponItem.IsWeaponMaxLevel())
        {
            return;
        }

        if (weaponItem.Level == 0)
        {
            return;
        }

        if (PlayerDataPack.Instance.DecMoney(PlayerDataPack.MoneyGold, weaponItem.GetLvUPCost()))
        {
            ++weaponItem.Level;
            SaveClass(true);
        }

        Hashtable hash = new Hashtable();

        hash.Add("WeaponItem", weaponItem);
        GameCore.Instance.EventController.PushEvent(EVENT_TYPE.EVENT_LOGIC_UPGRADE_WEAPON, this, hash);
    }
示例#8
0
 private void OnChooseWeapon(WeaponDataItem chooseWeapon)
 {
     WeaponDataPack.Instance.SetSelectWeapon(chooseWeapon.ItemDataID);
     _WeaponContainer.RefreshItems();
 }
示例#9
0
 public void SetSelectWeapon(string weaponID)
 {
     _SelectedWeapon     = weaponID;
     _SelectedWeaponItem = null;
     SaveClass(true);
 }
示例#10
0
 public static int GetWeaponLevelUpMoney(WeaponDataItem weaponItem)
 {
     return(1);
 }
示例#11
0
    public void RefreshWeaponItem(WeaponDataItem weaponItem)
    {
        //_Name.text = StrDictionary.GetFormatStr(weaponItem.WeaponRecord.NameDict);
        ResourceManager.Instance.SetImage(_Icon, weaponItem.WeaponRecord.Icon);
        _SkillName.text = StrDictionary.GetFormatStr(weaponItem.WeaponRecord.SkillName);
        var curAttr = weaponItem.GetCurLevelAttrs();

        _Atk.text = ((int)curAttr.x).ToString();
        _HP.text  = ((int)curAttr.y).ToString();
        _NextAttrs.SetActive(false);

        if (UIChangeWeapon.GetShowTag() == 0)
        {
            _BtnLvUp.gameObject.SetActive(false);
            _MaxLevelTip.SetActive(false);

            if (weaponItem.Level > 0)
            {
                _BtnBuy.gameObject.SetActive(false);

                if (weaponItem.ItemDataID == WeaponDataPack.Instance._SelectedWeapon)
                {
                    _BtnEquip.gameObject.SetActive(false);
                    _BtnEquiped.gameObject.SetActive(true);
                }
                else
                {
                    _BtnEquip.gameObject.SetActive(true);
                    _BtnEquiped.gameObject.SetActive(false);
                }

                _Level.text = "Lv." + (weaponItem.Level - 1).ToString();
            }
            else
            {
                _BtnEquip.gameObject.SetActive(false);
                _BtnBuy.gameObject.SetActive(true);
                _BuyPrice.ShowCurrency(PlayerDataPack.MoneyGold, weaponItem.WeaponRecord.Price);

                _Level.text = "";
            }
        }
        else
        {
            _BtnEquip.gameObject.SetActive(false);
            _BtnBuy.gameObject.SetActive(false);
            _BtnEquiped.gameObject.SetActive(false);

            _Level.text = "Lv." + (weaponItem.Level - 1) + "/" + weaponItem.WeaponRecord.MaxLevel;

            if (weaponItem.Level == 0)
            {
                _BtnEquip.gameObject.SetActive(false);
                _BtnBuy.gameObject.SetActive(true);
                _Level.text = "Lv.0";
                _BuyPrice.ShowCurrency(PlayerDataPack.MoneyGold, weaponItem.WeaponRecord.Price);
            }
            else if (!weaponItem.IsWeaponMaxLevel())
            {
                _BtnLvUp.gameObject.SetActive(true);
                _MaxLevelTip.SetActive(false);

                _NextAttrs.SetActive(true);
                var nextAttr = weaponItem.GetNextLevelAttrs();
                _NextLvAtk.text = "+" + ((int)nextAttr.x - curAttr.x).ToString();
                _NextLvHP.text  = "+" + ((int)nextAttr.y - curAttr.y).ToString();

                if (weaponItem.IsGetWeapon())
                {
                    _LvUpPrice.gameObject.SetActive(true);
                    _LvUpPrice.ShowCurrency(PlayerDataPack.MoneyGold, weaponItem.GetLvUPCost());
                }
                else
                {
                    _LvUpPrice.gameObject.SetActive(false);
                }
            }
            else
            {
                _BtnLvUp.gameObject.SetActive(false);
                _MaxLevelTip.SetActive(true);
            }
        }
    }