コード例 #1
0
    //让一个角色获得羁绊效果
    public override void GetEffect(RoleBase role)
    {
        if (effectIndex == -1)
        {
            return;
        }

        if (type == 1)
        {
            foreach (var v in attributes)
            {
                role.attributes[v.Key] += v.Value[effectIndex];
            }
        }
        else if (type == 2)
        {
            foreach (var v in attributes)
            {
                float changeVlu = ConfigRoleManager.Instance().allDatas[role.GetRoleId()].attributes[role.GetLevel() - 1][v.Key]
                                  * v.Value[effectIndex] * 1.0f / 100;



                role.attributes[v.Key] += changeVlu;
            }
        }
        else
        {
            Debug.LogError("羁绊 数值 种类数据配置错误");
        }
    }
コード例 #2
0
    //让一个角色移出羁绊效果
    public override void RemoveEffect(RoleBase role, int effectIndex)
    {
        if (effectIndex == -1 | role == null)
        {
            return;
        }

        //数值
        if (type == 1)
        {
            foreach (var v in attributes)
            {
                role.attributes[v.Key] -= v.Value[effectIndex];
            }
        }
        //百分比
        else if (type == 2)
        {
            foreach (var v in attributes)
            {
                float changeVlu = DataClass.ConfigRoleManager.Instance().allDatas[role.GetRoleId()].attributes[role.GetLevel() - 1][v.Key]
                                  * v.Value[effectIndex] * 1.0f / 100;

                role.attributes[v.Key] -= changeVlu;
            }
        }
        else
        {
            Debug.LogError("羁绊 数值 种类数据配置错误");
        }
    }
コード例 #3
0
    public void ShowRoleInfo(RoleBase role, RoleInfoType type = RoleInfoType.Pre)
    {
        if (role == null)
        {
            return;
        }

        int level             = role.GetLevel();
        var attributeData     = DataClass.ConfigAttributeManager.Instance().allDatas;
        var roleAttributeData = DataClass.ConfigRoleManager.Instance().allDatas[role.GetRoleId()].attributes[level - 1];
        var attributeSb       = new System.Text.StringBuilder();

        if (type == RoleInfoType.Pre)
        {
            for (int i = 0; i < 7; i++)
            {
                float nowValue = role.attributes[i];   //当前属性
                int   orValue  = roleAttributeData[i]; //原属性

                if (nowValue > orValue)
                {
                    attributeSb.Append($"{attributeData[i].name}:<color=yellow>{nowValue.ToString()}</color>  ");
                }
                else
                {
                    attributeSb.Append($"{attributeData[i].name}:{nowValue.ToString()}  ");
                }
            }
        }
        else
        {
            for (int i = 0; i < 5; i++)
            {
                float nowValue = role.attributes[i];   //当前属性
                int   orValue  = roleAttributeData[i]; //原属性

                if (nowValue > orValue)
                {
                    attributeSb.Append($"{attributeData[i].name}:<color=yellow>{nowValue.ToString()}</color>  ");
                }
                else
                {
                    attributeSb.Append($"{attributeData[i].name}:{nowValue.ToString()}  ");
                }
            }

            attributeSb.Append($"{attributeData[5].name}:{role.attributes[7].ToString()}/{role.attributes[5].ToString()} {attributeData[6].name}:{role.attributes[8].ToString()}/{role.attributes[6].ToString()}");
        }


        string cooperName   = DataClass.ConfigCooperationManager.Instance().allDatas[role.GetCooperId()].name;
        string proName      = DataClass.ConfigProfessionManager.Instance().allDatas[role.GetProId()].name;
        string equipContent = $"{role.GetEquip(0)?.desc}\n{role.GetEquip(1)?.desc}";

        string content = $"<size=50><color={ConstConfig.levelColor[role.cost]}>{role.name}</color></size>\n<color={ConstConfig.typeColor}>等级:{level.ToString()}【{cooperName}】 【{proName}】</color>\n\n{attributeSb.ToString()} {role.ShowMissCirtInfo()}\n<color={ConstConfig.skillColor}>{role.skill?.GetDesc()}</color>\n{equipContent}";

        ShowInfo(content);
    }
コード例 #4
0
    //-----------------------------------------------------------------------------------羁绊

    //-----------------------------------------------------------------------------------羁绊

    /// <summary>
    /// 准备队列增加角色,(交换战斗队列与准备队列的角色时不走该接口
    /// </summary>
    /// <param name="role">角色</param>
    /// <param name="idx">角色即将所在准备队列中的索引</param>
    /// <param name="orIdx">角色在战斗队列中的索引</param>
    public bool AddRolePre(RoleBase role)
    {
        //判断准备队列里有多少个角色
        int count = 0;

        for (int i = 0; i < preRoles.Length; i++)
        {
            if (preRoles[i] != null)
            {
                count++;
            }
        }
        //小于最大的角色数量
        if (count < Max_Pre_Role_Count)
        {
            //找个空位置给他
            for (int i = 0; i < preRoles.Length; i++)
            {
                if (preRoles[i] == null)
                {
                    preRoles[i] = role;

                    EventManager.ExecuteEvent(EventType.PreRoleUpdate, i);

                    TryRoleUpLevel(role.GetRoleId(), role.GetLevel());

                    break;
                }
            }
            return(true);
        }
        else    //角色满了
        {
            //先判断是否可以合成
            bool res = TryRoleUpLevel(role.GetRoleId(), role.GetLevel(), 2);
            if (!res)
            {
                WndTips.ShowTips("玩家准备区域拥有的角色达到最大数量");
            }

            return(res);
        }
    }
コード例 #5
0
        public void UpdateView()
        {
            if (role != null)
            {
                string cooperName = RoleBase.GetCooperName(role.GetRoleId());
                string proName    = RoleBase.GetPreName(role.GetRoleId());

                nameText.text = $"<color={ConstConfig.levelColor[role.cost]}>{role.name}</color>\n【{cooperName}】\n【{proName}】";

                toneImage.sprite = AssetLoader.instance.tones[role.cost - 1];
                int level = role.GetLevel();
                kuang0Image.sprite = AssetLoader.instance.kuang0s[level - 1];
                kuang1Image.sprite = AssetLoader.instance.kuang1s[level - 1];
                UpdateEquip();

                roleGo.SetActive(true);
            }
            else
            {
                roleGo.SetActive(false);
            }
        }
コード例 #6
0
        public override void OnEquipUp(RoleBase owner)
        {
            var datas = DataClass.ConfigRoleManager.Instance().allDatas[owner.GetRoleId()];
            //原始速度
            int orSudu   = datas.attributes[owner.GetLevel() - 1][2];
            int orShouyu = datas.attributes[owner.GetLevel() - 1][1];

            sudu   = (int)(orShouyu * 0.5f);
            shouyu = (int)(orShouyu * 0.5f);

            owner.attributes[1] += shouyu;
            owner.attributes[2] -= sudu;
        }
コード例 #7
0
    //指定位置上覆盖一个新角色,原来该位置要保证为空
    public void AddFightRole(RoleBase role, int index)
    {
        if (fightRoles[index] != null)
        {
            Debug.LogError($"索引为{index}的位置上角色不为空,不能直接赋值新角色");
            return;
        }

        SetFightRole(role, index, EnumType.RoleUpdateType.AddFight);
        if (role != null)
        {
            TryRoleUpLevel(role.GetRoleId(), role.GetLevel());
        }
    }
コード例 #8
0
    //更新羁绊数值,当前的羁绊有校数值
    public override void UpdateCooperCount(RoleBase[] fightRoles)
    {
        etlCount = 0;
        List <int> roleIdList = new List <int>();

        for (int i = 0; i < fightRoles.Length; i++)
        {
            RoleBase role = fightRoles[i];
            if (role != null)
            {
                int proId  = role.GetProId();
                int roleId = role.GetRoleId();
                if (!roleIdList.Contains(roleId) && proId == id)
                {
                    roleIdList.Add(roleId);
                }
            }
        }
        etlCount = roleIdList.Count;
    }