Beispiel #1
0
    /// <summary>
    /// 通过setting获取属性数值
    /// </summary>
    /// <param name="propertySetting"></param>
    /// <returns></returns>
    int GetRdmProperty(PropertyIdType id)
    {
        PropertySetting propertySetting = DataTable.FindPropertySetting((int)id);

        string[] rdmRange = propertySetting.newRdmRange.Split('|');
        int      val      = RandomManager.Next(rdmRange[0].ToInt32(), rdmRange[1].ToInt32());

        return(val);
    }
Beispiel #2
0
    /// <summary>
    /// 初始化人物属性
    /// </summary>
    /// <param name="propertyData"></param>
    /// <param name="idType"></param>
    /// <param name="propertyNum"></param>
    public void InitSingleProperty(PropertyData propertyData, PropertyIdType idType, float propertyNum, bool isExamBattle)
    {
        PropertySetting setting = DataTable.FindPropertySetting((int)idType);

        //PropertyData propertyData = new PropertyData();
        //如果属性为-1 说明是考试属性 从property表读取
        if (isExamBattle)
        {
            //TestEnemyNumerialSetting examSetting = DataTable.FindTestNumerial((int)idType));
            ////考试数值需要和等级挂钩
            //SinglePropertyData examPro = new SinglePropertyData();
            //examPro.PropertyId = (int)idType;
            //examPro.PropertyNum = propertyNum;
            //examPro.PropertyLimit = -1;

            //curExamProperty不应该在这里赋值 而应该在考试时赋值
            //propertyData.CurExamPropertyIdList.Add((int)idType);
            //propertyData.CurExamPropertyDataList.Add(examPro);

            if (propertyData.ExamPropertyIdList.Contains((int)idType))
            {
                int index = propertyData.ExamPropertyIdList.IndexOf((int)idType);
                propertyData.ExamPropertyDataList[index].PropertyNum = propertyNum;
            }
            else
            {
                SinglePropertyData initsinglePropertyData = new SinglePropertyData();
                initsinglePropertyData.PropertyId    = (int)idType;
                initsinglePropertyData.PropertyNum   = propertyNum;
                initsinglePropertyData.PropertyLimit = -1;

                propertyData.ExamPropertyIdList.Add((int)idType);
                propertyData.ExamPropertyDataList.Add(initsinglePropertyData);
            }
        }
        else
        {
            if (propertyData.PropertyIdList.Contains((int)idType))
            {
                int index = propertyData.PropertyIdList.IndexOf((int)idType);
                propertyData.PropertyDataList[index].PropertyNum = propertyNum;
            }
            else
            {
                SinglePropertyData singlePropertyData = new SinglePropertyData();
                singlePropertyData.PropertyId    = (int)idType;
                singlePropertyData.PropertyNum   = propertyNum;
                singlePropertyData.PropertyLimit = setting.haveLimit.ToInt32();

                propertyData.PropertyIdList.Add((int)idType);

                propertyData.PropertyDataList.Add(singlePropertyData);
            }
        }
        //return singlePropertyData;
    }
Beispiel #3
0
 /// <summary>
 /// 通过id得到初始战斗属性
 /// </summary>
 /// <param name="propertyData"></param>
 public SinglePropertyData GetInitExamPropertyById(PropertyIdType propertyIdType, PropertyData pro)
 {
     for (int i = 0; i < pro.ExamPropertyIdList.Count; i++)
     {
         if (pro.ExamPropertyIdList[i] == (int)propertyIdType)
         {
             return(pro.ExamPropertyDataList[i]);
         }
     }
     return(null);
 }
Beispiel #4
0
    /// <summary>
    /// 增加能力值 传了人就是给人加
    /// </summary>
    /// <param name="propertyIdType"></param>
    /// <param name="num"></param>
    public void AddProperty(PropertyIdType propertyIdType, int num, PeopleProtoData peopleProto = null)
    {
        if (peopleProto == null)
        {
            peopleProto = _CurGameInfo.PlayerPeople;
        }
        if (peopleProto.PropertyData.PropertyIdList.Contains((int)propertyIdType))
        {
            int index = peopleProto.PropertyData.PropertyIdList.IndexOf((int)propertyIdType);
            SinglePropertyData singleData = peopleProto.PropertyData.PropertyDataList[index];
            float limit   = singleData.PropertyLimit;
            float realAdd = num;
            //如果该属性存在最大限制
            if (limit >= 0)
            {
                if (realAdd + singleData.PropertyNum >= limit)
                {
                    realAdd = limit - singleData.PropertyNum;
                }
            }

            //如果是经验 则增加等级
            switch (propertyIdType)
            {
            case PropertyIdType.Study:
                LevelInfo levelInfo = GetPeopleLevelInfo(Mathf.RoundToInt(realAdd));
                peopleProto.PropertyData.CurExp = levelInfo.ExpAfterUpgrade;
                peopleProto.PropertyData.Level  = levelInfo.canReachLevel;
                break;

            case PropertyIdType.Physical:
                LevelInfo physicalLevelInfo = GetPeoplePhysicalLevelInfo(Mathf.RoundToInt(realAdd));
                peopleProto.PropertyData.CurPhysicalExp = physicalLevelInfo.ExpAfterUpgrade;
                peopleProto.PropertyData.PhysicalLevel  = physicalLevelInfo.canReachLevel;
                break;

            case PropertyIdType.Art:
                LevelInfo artLevelInfo = GetPeopleArtLevelInfo(Mathf.RoundToInt(realAdd));
                peopleProto.PropertyData.CurArtExp = artLevelInfo.ExpAfterUpgrade;
                peopleProto.PropertyData.ArtLevel  = artLevelInfo.canReachLevel;
                break;

            default:
                break;
            }

            singleData.PropertyNum += realAdd;
            RefreshProperty(peopleProto.PropertyData);
        }
    }
Beispiel #5
0
 /// <summary>
 /// 获取能力
 /// </summary>
 public SinglePropertyData FindSinglePropertyData(PropertyIdType propertyIdType, PeopleProtoData peopleProto = null)
 {
     //int studyId=ConstantVal
     if (peopleProto == null)
     {
         peopleProto = _CurGameInfo.PlayerPeople;
     }
     if (_CurGameInfo.PlayerPeople.PropertyData.PropertyIdList.Contains((int)propertyIdType))
     {
         int index = _CurGameInfo.PlayerPeople.PropertyData.PropertyIdList.IndexOf((int)propertyIdType);
         return(_CurGameInfo.PlayerPeople.PropertyData.PropertyDataList[index]);
     }
     return(null);
 }
Beispiel #6
0
 /// <summary>
 /// 改变考试属性的值
 /// </summary>
 /// <param name="propertyIdType"></param>
 /// <param name="val"></param>
 public void ChangeCurExamPropertyData(PropertyData data, PropertyIdType propertyIdType, int val)
 {
     for (int i = 0; i < data.CurExamPropertyIdList.Count; i++)
     {
         if (data.CurExamPropertyIdList[i] == (int)propertyIdType)
         {
             SinglePropertyData singleData = data.CurExamPropertyDataList[i];
             singleData.PropertyNum += val;
             if (singleData.PropertyNum < 0)
             {
                 singleData.PropertyNum = 0;
             }
         }
     }
 }
Beispiel #7
0
 /// <summary>
 /// 减少能力值
 /// </summary>
 /// <param name="propertyIdType"></param>
 /// <param name="num"></param>
 public void DeProperty(PropertyIdType propertyIdType, int num, PeopleProtoData peopleProto = null)
 {
     if (peopleProto == null)
     {
         peopleProto = _CurGameInfo.PlayerPeople;
     }
     if (peopleProto.PropertyData.PropertyIdList.Contains((int)propertyIdType))
     {
         int index = peopleProto.PropertyData.PropertyIdList.IndexOf((int)propertyIdType);
         SinglePropertyData singleData = peopleProto.PropertyData.PropertyDataList[index];
         singleData.PropertyNum += num;
         //如果该属性小于0 则等于0
         if (singleData.PropertyNum <= 0)
         {
             singleData.PropertyNum = 0;
         }
     }
 }
Beispiel #8
0
    //List<SingleExamEnemy> curExamEnemyList=

    /// <summary>
    /// 开始考试
    /// </summary>
    public void StartExam(ExamSetting examSetting)
    {
        //扣除体力
        string[]           costArr         = examSetting.cost.Split('|');
        PropertyIdType     theId           = (PropertyIdType)costArr[0].ToInt32();
        int                num             = costArr[1].ToInt32();
        SinglePropertyData pro             = RoleManager.Instance.FindSinglePropertyData(theId);
        PropertySetting    propertySetting = DataTable.FindPropertySetting(pro.PropertyId);

        if (RoleManager.Instance.FindSinglePropertyData(theId).PropertyNum < num)
        {
            PanelManager.Instance.OpenFloatWindow(propertySetting.name + "不足");
        }
        else
        {
            RoleManager.Instance.DeProperty(theId, num);
            GenerateExam(examSetting);
        }
    }
Beispiel #9
0
    public void InitExamProperty(PropertyIdType idType, float num, PropertyData property)
    {
        SinglePropertyData singlePropertyData = new SinglePropertyData();

        singlePropertyData.PropertyId  = (int)idType;
        singlePropertyData.PropertyNum = num;

        property.CurExamPropertyIdList.Add((int)idType);
        property.CurExamPropertyDataList.Add(singlePropertyData);

        SinglePropertyData initSinglePropertyData = new SinglePropertyData();

        initSinglePropertyData.PropertyId  = (int)idType;
        initSinglePropertyData.PropertyNum = num;

        property.ExamPropertyIdList.Add((int)idType);
        property.ExamPropertyDataList.Add(initSinglePropertyData);

        //return singlePropertyData;
    }
        public void MSFSSHTTP_FSSHTTPB_TestCase_S20_TC01_Properties_ErrorCode()
        {
            // Initialize the service
            this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain);
            string fileName = this.DefaultFileUrl.Substring(this.DefaultFileUrl.LastIndexOf("/", System.StringComparison.OrdinalIgnoreCase) + 1);

            PropertyIdType property = new PropertyIdType();

            property.id = fileName;
            PropertyIdType[] propertyId = new PropertyIdType[] { property };

            PropertiesSubRequestType propertiess = SharedTestSuiteHelper.CreatePropertiesSubRequest(SequenceNumberGenerator.GetCurrentToken(), PropertiesRequestTypes.PropertyGet, propertyId, this.Site);
            CellStorageResponse      response    = this.Adapter.CellStorageRequest(null, new SubRequestType[] { propertiess });

            if (Common.IsRequirementEnabled(2302011, this.Site))
            {
                PropertiesSubResponseType propertiesResponse = SharedTestSuiteHelper.ExtractSubResponse <PropertiesSubResponseType>(response, 0, 0, this.Site);
                SubResponseType           subresponse        = response.ResponseCollection.Response[0].SubResponse[0];

                if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
                {
                    // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2302011
                    Site.CaptureRequirementIfAreNotEqual <string>(
                        GenericErrorCodeTypes.Success.ToString(),
                        subresponse.ErrorCode,
                        "MS-FSSHTTP",
                        2302011,
                        @"[PropertiesSubResponseType]In the case of failure, the ErrorCode attribute that is part of a SubResponse element specifies the error code result for this subrequest. ");
                }
                else
                {
                    Site.Assert.AreNotEqual <string>(
                        GenericErrorCodeTypes.Success.ToString(),
                        subresponse.ErrorCode,
                        "In the case of failure, the ErrorCode attribute that is part of a SubResponse element specifies the error code result for this subrequest.");
                }
            }
        }
        /// <summary>
        /// This method is used to map concrete property IDs to abstract, client-defined named properties. 
        /// </summary>
        /// <param name="propertyIdType">Specifies different PropertyId type.</param>
        public void RopGetNamesFromPropertyIdsMethod(PropertyIdType propertyIdType)
        {
            // The property IDs needs to get in RopGetNamesFromPropertyIds ROP request.
            PropertyId[] propertyIds = new PropertyId[1];
            #region Set and save property
            if (propertyIdType == PropertyIdType.HaveAssociatedName || propertyIdType == PropertyIdType.LessThan0x8000)
            {
                TaggedPropertyValue[] tagPropertyValue = new TaggedPropertyValue[1];
                tagPropertyValue[0] = this.GetTaggedPropertyTag(ObjectToOperate.FirstObject);
                if (tagPropertyValue[0].PropertyTag.PropertyType == 0x0102)
                {
                    tagPropertyValue[0].Value = Common.AddInt16LengthBeforeBinaryArray(tagPropertyValue[0].Value);
                }

                this.RopSetProperties(this.cprptFirstHandle, tagPropertyValue, true);
                if (this.cprptCurrentType == ServerObjectType.Message)
                {
                    this.RopSaveChangesMessage(this.cprptFirstHandle, true);
                }
                else if (this.cprptCurrentType == ServerObjectType.Attachment)
                {
                    this.RopSaveChangesAttachment(this.cprptFirstHandle, true);
                }
            }
            #endregion

            RopGetNamesFromPropertyIdsResponse getNamesFromPropertyIdsResponse = this.RopGetNamesFromPropertyIds(this.cprptCurrentHandle, propertyIds);

            #region Verify response
            this.VerifyRopGetNamesFromPropertyIds((ushort)propertyIds.Length, propertyIds, getNamesFromPropertyIdsResponse, this.cprptCurrentType);

            this.Site.Assert.AreEqual((uint)CPRPTErrorCode.None, getNamesFromPropertyIdsResponse.ReturnValue, string.Format("RopGetNamesFromPropertyIds Failed! Error: 0x{0:X8}", getNamesFromPropertyIdsResponse.ReturnValue));

            #endregion
        }
        public void TestCase_S20_TC01_Properties_Success()
        {
            // Initialize the service
            this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain);

            string[]       ids        = new string[] { "RealtimeTypingEndpointUrl", "DocumentAccessToken", "DocumentAccessTokenTtl" };
            PropertyIdType propertyId = new PropertyIdType();

            PropertyIdType[] propertyIds = new PropertyIdType[3];

            for (int i = 0; i < ids.Length; i++)
            {
                propertyId.id  = ids[i];
                propertyIds[i] = propertyId;
            }

            PropertiesSubRequestType properties = SharedTestSuiteHelper.CreatePropertiesSubRequest(SequenceNumberGenerator.GetCurrentToken(), PropertiesRequestTypes.PropertyGet, propertyIds, this.Site);

            CellStorageResponse       cellStorageResponse = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { properties });
            PropertiesSubResponseType propertiesResponse  = SharedTestSuiteHelper.ExtractSubResponse <PropertiesSubResponseType>(cellStorageResponse, 0, 0, this.Site);
            SubResponseType           subresponse         = cellStorageResponse.ResponseCollection.Response[0].SubResponse[0];

            if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
            {
                // Capture the requirement MS-FSSHTTP_R246801
                Site.CaptureRequirement(
                    "MS-FSSHTTP",
                    246801,
                    @"[In Appendix B: Product Behavior] Implementation does support Properties operation. (SharePoint Server 2016 and above follow this behavior.)");

                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2301011
                Site.CaptureRequirementIfAreEqual <string>(
                    GenericErrorCodeTypes.Success.ToString(),
                    subresponse.ErrorCode,
                    "MS-FSSHTTP",
                    2301011,
                    @"[PropertiesSubResponseType]In the case of success, it contains information requested as part of a Properties subrequest. ");

                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2443
                Site.CaptureRequirementIfAreEqual <ErrorCodeType>(
                    ErrorCodeType.Success,
                    SharedTestSuiteHelper.ConvertToErrorCodeType(subresponse.ErrorCode, this.Site),
                    "MS-FSSHTTP",
                    2443,
                    @"[Properties Subrequest][The protocol server returns results based on the following conditions:]An ErrorCode value of ""Success"" indicates success in processing the Properties request.");

                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2447
                Site.CaptureRequirement(
                    "MS-FSSHTTP",
                    2447,
                    @"[Property Get]If the Properties attribute is set to ""PropertyGet"", the protocol server considers the Properties subrequest to be of type ""Property Get "". ");

                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2299
                Site.CaptureRequirementIfIsNotNull(
                    propertiesResponse.SubResponseData.PropertyValues,
                    "MS-FSSHTTP",
                    2299,
                    @"[PropertiesSubResponseDataType][PropertyValues]This element MUST only be included in the response if the Properties attribute value is set to ""PropertyGet"".");
            }
            else
            {
                Site.Assert.AreEqual <string>(
                    GenericErrorCodeTypes.Success.ToString(),
                    subresponse.ErrorCode,
                    "[PropertiesSubResponseType]In the case of success, it contains information requested as part of a Properties subrequest. ");
            }
        }
 public static void RopGetNamesFromPropertyIdsMethod(PropertyIdType propertyIdType)
 {
     Condition.IsTrue(isInitialized);
 }