Exemplo n.º 1
0
    public int GetAttack()
    {
        var key    = KeysUtil.GetNewKey(PropertyItem.ItemKey.value, PlaneProperty.Property.attack.ToString());
        var attack = DataMgr.Single.Get <int>(key);

        return(attack);
    }
    private void ChangeData(int ratio, PropertyItem.ItemKey itemKey, PlaneProperty.Property property)
    {
        var key   = KeysUtil.GetNewKey(itemKey, property.ToString());
        var value = DataMgr.Single.Get <int>(key);

        value *= ratio;
        DataMgr.Single.Set(key, value);
    }
Exemplo n.º 3
0
    private void UpdateSlider()
    {
        var slider = transform.Find("Slider").GetComponent <Slider>();

        slider.minValue = 0;
        slider.maxValue = DataMgr.Single.Get <int>(KeysUtil.GetNewKey(ItemKey.maxVaue, _key));
        slider.value    = DataMgr.Single.Get <int>(KeysUtil.GetNewKey(ItemKey.value, _key));
    }
Exemplo n.º 4
0
    private void ChangeData()
    {
        var valueKey  = KeysUtil.GetNewKey(PropertyItem.ItemKey.value, _key);
        var value     = GetValue(valueKey);
        var grouthKey = KeysUtil.GetNewKey(PropertyItem.ItemKey.grouth, _key);
        var grouth    = GetValue(grouthKey);

        value += grouth;

        DataMgr.Single.SetObject(valueKey, value);
    }
Exemplo n.º 5
0
    private void AddAction()
    {
        var key   = KeysUtil.GetPropertyKeys(_key + DataKeys.COST_UNIT);
        var unit  = DataMgr.Single.Get <string>(key);
        var money = GameStateModel.Single.GetMoney(unit);

        key = KeysUtil.GetNewKey(PropertyItem.ItemKey.cost, _key);
        var cost = DataMgr.Single.Get <int>(key);

        if (money >= cost)
        {
            ChangeData();
        }
        else
        {
            UIManager.Single.ShowDialog("你没星星了!");
        }
    }