Ejemplo n.º 1
0
    public string verticalDrawName;//立绘图片 TODO后续改成配表
    /// <summary>
    /// TODO通过配表的Setting创建新People(PeopleData后续要改成PeopleSetting)
    /// </summary>
    /// <param name="peopleData"></param>
    public People(PeopleData peopleData)
    {
        this.name   = peopleData.name;
        this.gender = peopleData.gender;
        if (peopleData.name == "毛鹏程")
        {
            isPlayer = true;
        }

        if (gender == Gender.Male)
        {
            int val = RandomManager.Next(1, 4);
            verticalDrawName = "boy" + val;
        }
        else
        {
            int val = RandomManager.Next(1, 8);
            verticalDrawName = "girl" + val;
        }

        PeopleProtoData peopleProtoData = new PeopleProtoData();

        peopleProtoData.Achievement        = new Achievement();
        peopleProtoData.OnlyId             = ConstantVal.SetId;
        peopleProtoData.Name               = peopleData.name;
        peopleProtoData.Gender             = (int)peopleData.gender;
        peopleProtoData.IsPlayer           = isPlayer;
        peopleProtoData.ExamBattleCurLevel = 1;
        CreateNewPropertyData(peopleProtoData);
        RoleManager.Instance.InitPeopleSocializationProperty(peopleProtoData);
        this.protoData = peopleProtoData;
    }
Ejemplo n.º 2
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);
        }
    }
Ejemplo n.º 3
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);
 }
Ejemplo n.º 4
0
    /// <summary>
    /// 社交对A 如卡顿 则考虑加载存档的时候把中间变量计算后缓存导peopledata里面 (加一个表现稳定性)1找2聊天
    /// </summary>
    /// <param name="p1"></param>
    /// <param name="p2"></param>
    public bool SocialAttack(PeopleProtoData p1, PeopleProtoData p2)
    {
        //1对2的好感度 1喜欢/讨厌2多少
        float influenceTo1 = CalcSocialAttack(p1, p2);


        if (!p1.SensedOtherPeopleIdList.Contains(p2.OnlyId))
        {
            p1.SensedOtherPeopleIdList.Add(p2.OnlyId);
            p1.FriendlinessToSensedOtherPeopleList.Add(0);
        }
        int index2 = p1.SensedOtherPeopleIdList.IndexOf(p2.OnlyId);

        p1.FriendlinessToSensedOtherPeopleList[index2] += influenceTo1;
        if (!p1.ContactedPeopleInSingleAction.Contains(p2.OnlyId))
        {
            p1.ContactedPeopleInSingleAction.Add(p2.OnlyId);
        }

        //2对1的好感度 2喜欢/讨厌1多少
        float influenceTo2 = CalcSocialAttack(p2, p1);

        if (!p2.SensedOtherPeopleIdList.Contains(p1.OnlyId))
        {
            p2.SensedOtherPeopleIdList.Add(p1.OnlyId);
            p2.FriendlinessToSensedOtherPeopleList.Add(0);
        }
        int index1 = p2.SensedOtherPeopleIdList.IndexOf(p1.OnlyId);

        p2.FriendlinessToSensedOtherPeopleList[index1] += influenceTo2;
        if (!p2.ContactedPeopleInSingleAction.Contains(p1.OnlyId))
        {
            p2.ContactedPeopleInSingleAction.Add(p1.OnlyId);
        }

        p1.ThisActionSocialized = true;
        p2.ThisActionSocialized = true;

        if (influenceTo2 < 0)
        {
            return(false);
        }
        else
        {
            return(true);
        }
    }
Ejemplo n.º 5
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;
         }
     }
 }
Ejemplo n.º 6
0
    /// <summary>
    /// 计算社交攻击值
    /// </summary>
    /// <param name="be"></param>
    /// <param name="attacker"></param>
    public float CalcSocialAttack(PeopleProtoData be, PeopleProtoData attacker)
    {
        float studyDefense1    = RoleManager.Instance.FindSinglePropertyData(PropertyIdType.StudyDefense, be).PropertyNum;
        float artDefense1      = RoleManager.Instance.FindSinglePropertyData(PropertyIdType.ArtDefense, be).PropertyNum;
        float physicalDefense1 = RoleManager.Instance.FindSinglePropertyData(PropertyIdType.PhysicalDefense, be).PropertyNum;

        float studyAttack2    = RoleManager.Instance.FindSinglePropertyData(PropertyIdType.StudyCharm, attacker).PropertyNum;    // DataTable.FindTestNumerialByLevel(p1.PropertyData.Level).proChange
        float artAttack2      = RoleManager.Instance.FindSinglePropertyData(PropertyIdType.ArtCharm, attacker).PropertyNum;      // DataTable.FindTestNumerialByLevel(p1.PropertyData.Level).proChange
        float physicalAttack2 = RoleManager.Instance.FindSinglePropertyData(PropertyIdType.PhysicalCharm, attacker).PropertyNum; // DataTable.FindTestNumerialByLevel(p1.PropertyData.Level).proChange

        float studyInfluenceTo1    = be.BeAttractParamList[0] / (float)100;
        float artInfluenceTo1      = be.BeAttractParamList[1] / (float)100;
        float physicalInfluenceTo1 = be.BeAttractParamList[2] / (float)100;

        float change1 = (studyAttack2 - studyDefense1) * studyInfluenceTo1 + (artAttack2 - artDefense1) * artInfluenceTo1 + (physicalAttack2 - physicalDefense1) * physicalInfluenceTo1;


        return(change1);
    }
Ejemplo n.º 7
0
    /// <summary>
    /// 创建新的属性数据(人)
    /// </summary>
    /// <param name="gameInfo"></param>
    void CreateNewPropertyData(PeopleProtoData peopleProtoData)
    {
        PropertyData propertyData = new PropertyData();

        propertyData.IsPlayer      = true;
        propertyData.OnlyId        = peopleProtoData.OnlyId;
        propertyData.Level         = 1;
        propertyData.ArtLevel      = 1;
        propertyData.PhysicalLevel = 1;

        RoleManager.Instance.InitProperty(propertyData);
        ////PropertySetting setting= DataTable.FindPropertySetting(PropertyIdType.Study)
        //RoleManager.Instance.InitSingleProperty(propertyData, PropertyIdType.Study, GetRdmProperty(PropertyIdType.Study),false);
        //RoleManager.Instance.InitSingleProperty(propertyData, PropertyIdType.Art, GetRdmProperty(PropertyIdType.Art), false);
        //RoleManager.Instance.InitSingleProperty(propertyData, PropertyIdType.Physical, GetRdmProperty(PropertyIdType.Physical), false);
        //RoleManager.Instance.InitSingleProperty(propertyData, PropertyIdType.Money, GetRdmProperty(PropertyIdType.Money), false);
        //RoleManager.Instance.InitSingleProperty(propertyData, PropertyIdType.TiLi, GetRdmProperty(PropertyIdType.TiLi), false);
        //RoleManager.Instance.InitSingleProperty(propertyData, PropertyIdType.Mood, GetRdmProperty(PropertyIdType.Mood), false);
        //RoleManager.Instance.InitSingleProperty(propertyData, PropertyIdType.SelfControl, GetRdmProperty(PropertyIdType.SelfControl), false);
        //RoleManager.Instance.InitSingleProperty(propertyData, PropertyIdType.Charm, GetRdmProperty(PropertyIdType.Charm), false);

        //RoleManager.Instance.InitSingleProperty(propertyData, PropertyIdType.Hp,DataTable.FindTestNumerialByLevel(propertyData.Level).hp.ToFloat(),true);
        //RoleManager.Instance.InitSingleProperty(propertyData, PropertyIdType.Attack, DataTable.FindTestNumerialByLevel(propertyData.Level).attack.ToFloat(),true);
        //RoleManager.Instance.InitSingleProperty(propertyData, PropertyIdType.Defense, DataTable.FindTestNumerialByLevel(propertyData.Level).defense.ToFloat(),true);
        //RoleManager.Instance.InitSingleProperty(propertyData, PropertyIdType.CritNum, DataTable.FindTestNumerialByLevel(propertyData.Level).crit.ToFloat(),true);
        //RoleManager.Instance.InitSingleProperty(propertyData, PropertyIdType.Speed, DataTable.FindTestNumerialByLevel(propertyData.Level).attackSpeed.ToFloat(),true);
        //RoleManager.Instance.InitSingleProperty(propertyData, PropertyIdType.CritRate, DataTable.FindTestNumerialByLevel(propertyData.Level).critRate.ToFloat(),true);
        //RoleManager.Instance.InitSingleProperty(propertyData, PropertyIdType.SkillAdd, DataTable.FindTestNumerialByLevel(propertyData.Level).skillHurtAdd.ToFloat(),true);

        //RoleManager.Instance.InitSingleProperty(propertyData, PropertyIdType.StudyCharm, DataTable.FindTestNumerialByLevel(propertyData.Level).studyCharm.ToFloat(),false);
        //RoleManager.Instance.InitSingleProperty(propertyData, PropertyIdType.StudyDefense, DataTable.FindTestNumerialByLevel(propertyData.Level).studyDefense.ToFloat(), false);
        //RoleManager.Instance.InitSingleProperty(propertyData, PropertyIdType.PhysicalCharm, DataTable.FindTestNumerialByLevel(propertyData.Level).physicalCharm.ToFloat(), false);
        //RoleManager.Instance.InitSingleProperty(propertyData, PropertyIdType.PhysicalDefense, DataTable.FindTestNumerialByLevel(propertyData.Level).physicalDefense.ToFloat(), false);
        //RoleManager.Instance.InitSingleProperty(propertyData, PropertyIdType.ArtCharm, DataTable.FindTestNumerialByLevel(propertyData.Level).artCharm.ToFloat(), false);
        //RoleManager.Instance.InitSingleProperty(propertyData, PropertyIdType.ArtDefense, DataTable.FindTestNumerialByLevel(propertyData.Level).artDefense.ToFloat(), false);

        peopleProtoData.PropertyData = propertyData;
    }
Ejemplo n.º 8
0
    /// <summary>
    /// 初始化人物社交属性 后续这个随机值根据性格来
    /// </summary>
    public void InitPeopleSocializationProperty(PeopleProtoData peopleProtoData)
    {
        int beAttractByStudy = RandomManager.Next(1, 99);

        int remain1           = 100 - beAttractByStudy;
        int beAttractByArt    = RandomManager.Next(1, remain1);
        int remain2           = remain1 - beAttractByArt;
        int beAttractByPhysic = 0;

        if (remain2 > 1)
        {
            beAttractByPhysic = RandomManager.Next(1, remain2);
        }
        else
        {
            beAttractByPhysic = 1;
        }
        peopleProtoData.BeAttractParamList.Add(beAttractByStudy);
        peopleProtoData.BeAttractParamList.Add(beAttractByArt);
        peopleProtoData.BeAttractParamList.Add(beAttractByPhysic);

        peopleProtoData.SocializationPreference = RandomManager.Next(1, 100);
    }
Ejemplo n.º 9
0
 /// <summary>
 /// TODO通过存档的Protocol来创建People(DEMO开发阶段为了可读性 另外存一份 后续全部采用Protocol数据)
 /// </summary>
 /// <param name="peopleProtoData"></param>
 public People(PeopleProtoData peopleProtoData)
 {
 }