Example #1
0
    // 设置经验
    public void AddExp(int exp)
    {
        int old_exp        = GetExp();
        int allExp         = exp + old_exp;
        int nowLevel       = GetLevel();
        int LevelUpNeedExp = GameTable.playerAttrTableAsset.LookUp(nowLevel).m_needExp;

        if (0 == LevelUpNeedExp)
        {
            return;
        }
        while (allExp > LevelUpNeedExp)
        {
            allExp         = allExp - LevelUpNeedExp;
            nowLevel       = nowLevel + 1;
            LevelUpNeedExp = GameTable.playerAttrTableAsset.LookUp(nowLevel).m_needExp;
            if (0 == LevelUpNeedExp)
            {
                break;
            }
        }

        UserProps.SetProperty_Int32(UserProperty.level, nowLevel);
        UserProps.SetProperty_Int32(UserProperty.exp, allExp);

        NotifyChanged((int)ENPropertyChanged.enUserPropertyChanged, null);

        Debug.Log("获取经验:" + exp + ",新等级:" + nowLevel + ",新经验:" + allExp);
    }
Example #2
0
    public void AddBagCapcity()
    {
        int nowBoughtTimes = UserProps.GetProperty_Int32(UserProperty.bagCapcity_expandedSize);

        UserProps.SetProperty_Int32(UserProperty.bagCapcity_expandedSize, nowBoughtTimes + 1);
        NotifyChanged((int)ENPropertyChanged.enUserPropertyChanged, null);
    }
Example #3
0
    public void SetLevelExp(int level, int exp)
    {
        m_lastLevel = GetLevel();
        UserProps.SetProperty_Int32(UserProperty.level, level);
        UserProps.SetProperty_Int32(UserProperty.exp, exp);

        // 如果升级了
        if (level > m_lastLevel)
        {
            // 回复体力和军资到最大
            UserProps.SetProperty_Int32(UserProperty.stamina, GetMaxStamina());
            UserProps.SetProperty_Int32(UserProperty.energy, GetMaxEnergy());
        }
        NotifyChanged((int)ENPropertyChanged.enUserPropertyChanged, null);
    }
Example #4
0
    public void AddDiamond(int diamond)
    {
        int bind_money = UserProps.GetProperty_Int32(UserProperty.bind_money);

        bind_money = bind_money + diamond;

        if (bind_money <= 0)
        {
            bind_money = 0;
        }

        UserProps.SetProperty_Int32(UserProperty.bind_money, bind_money);

        Debug.Log("添加或减少的钻石为:" + diamond + ",调整后的身上钻石为:" + bind_money);
    }
Example #5
0
    // 设置金币
    public void AddMoney(int money)
    {
        int num = UserProps.GetProperty_Int32(UserProperty.money);

        num = num + money;

        if (num <= 0)
        {
            num = 0;
        }

        UserProps.SetProperty_Int32(UserProperty.money, num);

        Debug.Log("设置金币:" + money + ",调整后的身上金币为:" + num);
        NotifyChanged((int)ENPropertyChanged.enUserPropertyChanged, null);
    }
Example #6
0
    public User()
    {
        SetPropertyObjectID((int)MVCPropertyID.enUserProps);

        UserProps = UserProperty.Singleton.CreatePropertySet("UserProperty");

        UserProps.SetProperty_String(UserProperty.name, "guo");
        UserProps.SetProperty_Int32(UserProperty.id, 123456789);
        UserProps.SetProperty_Int32(UserProperty.portrait, 1);
        UserProps.SetProperty_Int32(UserProperty.money, 1);
        UserProps.SetProperty_Int32(UserProperty.bind_money, 19000);
        UserProps.SetProperty_Int32(UserProperty.ring, 10);
        UserProps.SetProperty_Int32(UserProperty.friendship_point, 100);
        UserProps.SetProperty_Int32(UserProperty.level, 1);
        UserProps.SetProperty_Int32(UserProperty.exp, 0);
        UserProps.SetProperty_Int32(UserProperty.stamina, 12);
        UserProps.SetProperty_Int32(UserProperty.stamina_savetime, (int)TimeUtil.GetCurrentTimeStamp());
        UserProps.SetProperty_Int32(UserProperty.friendCount_expandedSize, 0);
        UserProps.SetProperty_Int32(UserProperty.bagCapcity_expandedSize, 0);

        IsTeamLeaderModel = false;
    }
Example #7
0
 public void SetNowSelectTeam(int teamIndex)
 {
     UserProps.SetProperty_Int32(UserProperty.nowSelect_team, teamIndex);
     NotifyChanged((int)ENPropertyChanged.enUserPropertyChanged, null);
 }
Example #8
0
 public void SetEnergy(int energy, int energySaveTime)
 {
     UserProps.SetProperty_Int32(UserProperty.energy, energy);
     UserProps.SetProperty_Int32(UserProperty.energy_savetime, energySaveTime);
     NotifyChanged((int)ENPropertyChanged.enUserPropertyChanged, null);
 }
Example #9
0
 public void SetStamina(int stamina, int staminaSaveTime)
 {
     UserProps.SetProperty_Int32(UserProperty.stamina, stamina);
     UserProps.SetProperty_Int32(UserProperty.stamina_savetime, staminaSaveTime);
     NotifyChanged((int)ENPropertyChanged.enUserPropertyChanged, null);
 }
Example #10
0
 public void SetFriendshpiPoint(int friendShipPoint)
 {
     UserProps.SetProperty_Int32(UserProperty.friendship_point, friendShipPoint);
     NotifyChanged((int)ENPropertyChanged.enUserPropertyChanged, null);
 }
Example #11
0
 public void SetRing(int ring)
 {
     UserProps.SetProperty_Int32(UserProperty.ring, ring);
     NotifyChanged((int)ENPropertyChanged.enUserPropertyChanged, null);
 }
Example #12
0
 public void SetBindMoney(int bindMoney)
 {
     UserProps.SetProperty_Int32(UserProperty.bind_money, bindMoney);
     NotifyChanged((int)ENPropertyChanged.enUserPropertyChanged, null);
 }
Example #13
0
 public void SetMoney(int money)
 {
     UserProps.SetProperty_Int32(UserProperty.money, money);
     NotifyChanged((int)ENPropertyChanged.enUserPropertyChanged, null);
 }
Example #14
0
    // 设置等级
    public void SetLevel(int level)
    {
        UserProps.SetProperty_Int32(UserProperty.level, level);

        Debug.Log("设置等级:" + level);
    }
Example #15
0
 public void SetExp(int exp)
 {
     UserProps.SetProperty_Int32(UserProperty.exp, exp);
 }