예제 #1
0
    /// <summary>
    /// 点击-升级
    /// </summary>
    public void OnClickForLevel()
    {
        UserDataBean          userData          = uiComponent.handler_GameData.GetUserData();
        UserModelPartDataBean userModelPartData = userModelData.GetUserPartDataById(modelPartInfo.id);

        if (userModelPartData == null)
        {
            return;
        }
        long levelMoney = modelPartInfo.GetLevelUpMoney(userModelPartData.level);
        bool isPay      = userData.PayMoney(levelMoney);

        if (isPay)
        {
            //升级
            int level = userModelPartData.LevelUp(1);
            //计算收益
            long addPrice = modelPartInfo.GetAddPrice(level);
            //增加收益
            userModelPartData.SetAddPrice(addPrice);
            //设置舰船显示进度
            uiComponent.handler_GameModel.SetPartProgress(modelPartInfo.part_name, userModelPartData.GetProgress(modelPartInfo.max_level));
        }
        else
        {
            LogUtil.Log("升级失败,没有足够的金钱");
        }
    }
예제 #2
0
    /// <summary>
    /// 点击解锁
    /// </summary>
    public void OnClickForUnlock()
    {
        UserDataBean userData = uiComponent.handler_GameData.GetUserData();
        bool         isPay    = userData.PayMoney(modelPartInfo.unlock_money);

        if (isPay)
        {
            //添加解锁数据
            UserModelPartDataBean userModelPartData = userModelData.AddUnLockPart(modelPartInfo.id, modelPartInfo.GetAddPrice(0));
            //设置显示部件
        }
        else
        {
            LogUtil.Log("解锁失败,没有足够的金钱");
        }
    }
예제 #3
0
    /// <summary>
    /// 点击解锁
    /// </summary>
    public void OnClickForUnlock()
    {
        UserDataBean userData = uiComponent.handler_GameData.GetUserData();
        bool         isPay    = userData.PayMoney(modelInfo.unlock_money);

        if (isPay)
        {
            //添加解锁数据
            UserModelDataBean userModelData = userData.AddUnLockModel(modelInfo.id);
            //设置为当前显示
            userData.SetFirstUnlockModel(userModelData);
            Action action = () =>
            {
                //uiComponent.handler_GameModel.SetPartProgress("Cube", 0f);
            };
            //加载模型
            uiComponent.handler_GameModel.LoadModel(userModelData, action);
        }
        else
        {
            LogUtil.Log("支付失败,没有足够的金钱");
        }
    }