Esempio n. 1
0
 public override void Init(params object[] args)
 {
     base.Init(args);
     //propertySetting = args[0] as PropertySetting;
     singlePropertyData = args[0] as SinglePropertyData;
     propertySetting    = DataTable.FindPropertySetting(singlePropertyData.PropertyId);
 }
Esempio n. 2
0
    /// <summary>
    /// 初始化属性
    /// </summary>
    public void InitProperty(PropertyData propertyData)
    {
        propertyData.ExamPropertyDataList.Clear();
        propertyData.ExamPropertyIdList.Clear();
        propertyData.PropertyIdList.Clear();
        propertyData.PropertyDataList.Clear();

        ///先把初始随机的属性赋值
        for (int i = 0; i < DataTable._propertyList.Count; i++)
        {
            PropertySetting setting = DataTable._propertyList[i];


            //若是初始随机的属性,则按照配置表随机一个值
            if (setting.isInitRdm == "1")
            {
                SinglePropertyData singlePro = new SinglePropertyData();
                singlePro.PropertyLimit = setting.haveLimit.ToInt32();
                singlePro.PropertyId    = setting.id.ToInt32();
                string[] rdmRange = setting.newRdmRange.Split('|');
                int      val      = RandomManager.Next(rdmRange[0].ToInt32(), rdmRange[1].ToInt32());
                propertyData.PropertyIdList.Add(setting.id.ToInt32());
                singlePro.PropertyNum = val;

                propertyData.PropertyDataList.Add(singlePro);
            }
        }
        RefreshProperty(propertyData);
    }
Esempio n. 3
0
    /// <summary>
    /// 生成一组测试数据
    /// </summary>
    public void GenerateExam(ExamSetting examSetting)
    {
        ExamData examData = new ExamData();

        examData.SettingId = examSetting.id.ToInt32();
        RoleManager.Instance._CurGameInfo.CurActionData.CurExamData = examData;
        for (int i = 0; i < 8; i++)
        {
            SingleExamEnemy enemy = new SingleExamEnemy();
            enemy.Id     = DataTable.FindTestEnemyNumerialByLevel(examSetting.level.ToInt32()).id.ToInt32();
            enemy.Status = (int)SingleExamEnemyStatus.UnAccomplished;
            enemy.OnlyId = ConstantVal.SetId;
            InitExamProperty(enemy);
            RoleManager.Instance._CurGameInfo.CurActionData.CurExamData.EnemyList.Add(enemy);
        }
        //生成玩家的数据
        int count = RoleManager.Instance.playerPeople.protoData.PropertyData.ExamPropertyIdList.Count;

        RoleManager.Instance.playerPeople.protoData.PropertyData.CurExamPropertyIdList.Clear();
        RoleManager.Instance.playerPeople.protoData.PropertyData.CurExamPropertyDataList.Clear();

        for (int i = 0; i < count; i++)
        {
            int theId = RoleManager.Instance.playerPeople.protoData.PropertyData.ExamPropertyIdList[i];
            SinglePropertyData pro    = RoleManager.Instance.playerPeople.protoData.PropertyData.ExamPropertyDataList[i];
            SinglePropertyData newPro = pro.Clone();
            RoleManager.Instance.playerPeople.protoData.PropertyData.CurExamPropertyIdList.Add(theId);
            RoleManager.Instance.playerPeople.protoData.PropertyData.CurExamPropertyDataList.Add(newPro);
        }

        //发消息给view显示数据
        EventCenter.Broadcast(TheEventType.StartExam);
    }
Esempio n. 4
0
 public override void Init(params object[] args)
 {
     base.Init(args);
     singlePropertyData = args[0] as SinglePropertyData;
     //propertyId = (PropertyIdType)args[0];
     //setting = DataTable.FindPropertySetting((int)propertyId);
 }
Esempio n. 5
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;
    }
Esempio n. 6
0
    ///// <summary>
    ///// 获取能力值
    ///// </summary>
    //public int FindPropertyNum(PropertyIdType propertyIdType)
    //{
    //    //int studyId=ConstantVal
    //    if (_CurGameInfo.PlayerPeople.PropertyData.PropertyIdList.Contains((int)propertyIdType))
    //    {
    //        int index= _CurGameInfo.PlayerPeople.PropertyData.PropertyIdList.IndexOf((int)propertyIdType);
    //        return _CurGameInfo.PlayerPeople.PropertyData.PropertyDataList[index].PropertyNum;
    //    }
    //    return 0;
    //}

    /// <summary>
    /// 初始化战斗属性
    /// </summary>
    public void InitBattleProperty()
    {
        int count = playerPeople.protoData.PropertyData.CurExamPropertyIdList.Count;

        for (int i = 0; i < count; i++)
        {
            SinglePropertyData curPro = playerPeople.protoData.PropertyData.CurExamPropertyDataList[i];
            SinglePropertyData rawPro = playerPeople.protoData.PropertyData.ExamPropertyDataList[i];
            curPro.PropertyNum = rawPro.PropertyNum;
        }
    }
Esempio n. 7
0
    /// <summary>
    /// 获取显示在面板上的战斗属性
    /// </summary>
    /// <returns></returns>
    public List <SinglePropertyData> FindExamPropertyDataList()
    {
        List <SinglePropertyData> proList = new List <SinglePropertyData>();

        for (int i = 0; i < playerPeople.protoData.PropertyData.ExamPropertyDataList.Count; i++)
        {
            SinglePropertyData pro = playerPeople.protoData.PropertyData.ExamPropertyDataList[i];
            proList.Add(pro);
        }
        return(proList);
    }
Esempio n. 8
0
    /// <summary>
    /// 初始化当前战斗属性
    /// </summary>
    public void InitCurExamPropertyData(PropertyData PropertyData)
    {
        for (int i = 0; i < PropertyData.ExamPropertyIdList.Count; i++)
        {
            SinglePropertyData initData = PropertyData.ExamPropertyDataList[i];
            SinglePropertyData singleExamPropertyData = new SinglePropertyData();
            singleExamPropertyData.PropertyId  = initData.PropertyId;
            singleExamPropertyData.PropertyNum = initData.PropertyNum;

            PropertyData.CurExamPropertyDataList.Add(singleExamPropertyData);
            PropertyData.CurExamPropertyIdList.Add(singleExamPropertyData.PropertyId);
        }
    }
Esempio n. 9
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);
        }
    }
Esempio n. 10
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;
             }
         }
     }
 }
Esempio n. 11
0
    /// <summary>
    /// 通过从配置表解析出来的结构改变属性
    /// </summary>
    /// <param name="pro"></param>
    /// <param name="proChange"></param>
    public void InitPropertyChangeWithNumerial(PropertyData propertyData, List <List <float> > proChange)
    {
        for (int i = 0; i < proChange.Count; i++)
        {
            List <float>    single  = proChange[i];
            int             theId   = (int)single[0];
            float           theNum  = single[1];
            PropertySetting setting = DataTable.FindPropertySetting(theId);

            SinglePropertyData singlePro = new SinglePropertyData();
            singlePro.PropertyLimit = setting.haveLimit.ToInt32();
            singlePro.PropertyId    = theId;
            ////若不是随等级变化,则按照配置表随机一个值
            //if (setting.isChangeWithLevel != "1")
            //{
            //    string[] rdmRange = setting.newRdmRange.Split('|');
            //    int val = RandomManager.Next(rdmRange[0].ToInt32(), rdmRange[1].ToInt32());
            //    theNum = val;
            //}
            singlePro.PropertyNum = theNum;
            if (setting.isExamBattle == "1")
            {
                if (propertyData.ExamPropertyIdList.Contains(theId))
                {
                    int index = propertyData.ExamPropertyIdList.IndexOf(theId);
                    propertyData.ExamPropertyDataList[index].PropertyNum = theNum;
                }
                else
                {
                    propertyData.ExamPropertyIdList.Add(theId);
                    propertyData.ExamPropertyDataList.Add(singlePro);
                }
            }
            else
            {
                if (propertyData.PropertyIdList.Contains(theId))
                {
                    int index = propertyData.PropertyIdList.IndexOf(theId);
                    propertyData.PropertyDataList[index].PropertyNum = theNum;
                }
                else
                {
                    propertyData.PropertyIdList.Add(theId);
                    propertyData.PropertyDataList.Add(singlePro);
                }
            }
        }
    }
Esempio n. 12
0
    /// <summary>
    /// 显示状态
    /// </summary>
    public void ShowStatus()
    {
        SinglePropertyData hpPro = new SinglePropertyData();

        hpPro.PropertyId    = (int)PropertyIdType.Hp;
        hpPro.PropertyLimit = BattleManager.Instance.GetInitExamPropertyById(PropertyIdType.Hp, RoleManager.Instance.playerPeople.protoData.PropertyData).PropertyNum;
        hpPro.PropertyNum   = BattleManager.Instance.GetCurExamPropertyById(PropertyIdType.Hp, RoleManager.Instance.playerPeople.protoData.PropertyData).PropertyNum;
        PanelManager.Instance.OpenSingle <StatusPropertyView>(trans_statusGrid, hpPro);

        SinglePropertyData scorePro = new SinglePropertyData();

        scorePro.PropertyId    = (int)PropertyIdType.Score;
        scorePro.PropertyLimit = 100;
        scorePro.PropertyNum   = RoleManager.Instance._CurGameInfo.CurActionData.CurExamData.CurScore;
        PanelManager.Instance.OpenSingle <StatusPropertyView>(trans_statusGrid, scorePro);
    }
Esempio n. 13
0
    public override void OnOpenIng()
    {
        base.OnOpenIng();

        PropertyData propertyData = RoleManager.Instance._CurGameInfo.PlayerPeople.PropertyData;
        int          count        = propertyData.PropertyIdList.Count;

        for (int i = 0; i < count; i++)
        {
            int id = propertyData.PropertyIdList[i];
            SinglePropertyData singleData = propertyData.PropertyDataList[i];
            PropertySetting    setting    = DataTable.FindPropertySetting(id);
            if (setting.showInStatusPanel == "1")
            {
                PanelManager.Instance.OpenSingle <StatusPropertyView>(trans_grid, singleData);
            }
        }
    }
Esempio n. 14
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;
         }
     }
 }
Esempio n. 15
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);
        }
    }
Esempio n. 16
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;
    }