Ejemplo n.º 1
0
    /// <summary>
    /// 基本属性
    /// </summary>
    /// <param name="showInfo"></param>
    private void OnShowPropety(ViewPlayerData showInfo)
    {
        m_label_powerLabel.text = showInfo.power.ToString();
        m_trans_propRoot.parent.GetComponent <UIScrollView>().ResetPosition();
        GameCmd.ViewRoleData roledata = showInfo.viewRoleData;
        foreach (var item in m_dicLabls_Player)
        {
            PlayerLabelEnum type = item.Key;
            switch (type)
            {
            case PlayerLabelEnum.Name:
                item.Value.text = showInfo.username;
                break;

            case PlayerLabelEnum.ID:
                item.Value.text = showInfo.userid.ToString();
                break;

            case PlayerLabelEnum.Clan:
                if (string.IsNullOrEmpty(showInfo.clan_name))
                {
                    item.Value.text = "未加入";
                }
                else
                {
                    item.Value.text = showInfo.clan_name.ToString();
                }
                break;

            case PlayerLabelEnum.Level:
                item.Value.text = showInfo.user_level.ToString();
                break;

            case PlayerLabelEnum.DemonLv:
                item.Value.text = showInfo.god_level.ToString();
                break;

            case PlayerLabelEnum.HpMax:
                item.Value.text = roledata.maxhp.ToString();
                break;

            case PlayerLabelEnum.MpMax:
                item.Value.text = roledata.maxsp.ToString();
                break;

            case PlayerLabelEnum.PATK:
                item.Value.text = string.Format("{0}-{1}", roledata.pdam_min, roledata.pdam_max);
                break;

            case PlayerLabelEnum.MATK:
                item.Value.text = string.Format("{0}-{1}", roledata.mdam_min, roledata.mdam_max);
                break;

            case PlayerLabelEnum.PDEF:
                item.Value.text = string.Format("{0}-{1}", roledata.pdef_min, roledata.pdef_max);
                break;

            case PlayerLabelEnum.MDEF:
                item.Value.text = string.Format("{0}-{1}", roledata.mdef_min, roledata.mdef_max);
                break;

            case PlayerLabelEnum.Power:
                item.Value.text = roledata.liliang.ToString();
                break;

            case PlayerLabelEnum.Agile:
                item.Value.text = roledata.minjie.ToString();
                break;

            case PlayerLabelEnum.Intellect:
                item.Value.text = roledata.zhili.ToString();
                break;

            case PlayerLabelEnum.Strength:
                item.Value.text = roledata.tizhi.ToString();
                break;

            case PlayerLabelEnum.Spirit:
                item.Value.text = roledata.jingshen.ToString();
                break;

            case PlayerLabelEnum.FireATK:
                item.Value.text = roledata.esdam.ToString();
                break;

            case PlayerLabelEnum.IceATK:
                item.Value.text = roledata.ssdam.ToString();
                break;

            case PlayerLabelEnum.ElectricATK:
                item.Value.text = roledata.lsdam.ToString();
                break;

            case PlayerLabelEnum.DarkATK:
                item.Value.text = roledata.vsdam.ToString();
                break;

            case PlayerLabelEnum.FireDEF:
                item.Value.text = roledata.esdef.ToString();
                break;

            case PlayerLabelEnum.IceDEF:
                item.Value.text = roledata.ssdef.ToString();
                break;

            case PlayerLabelEnum.ElectricDEF:
                item.Value.text = roledata.lsdef.ToString();
                break;

            case PlayerLabelEnum.DarkDEF:
                item.Value.text = roledata.vsdef.ToString();
                break;

            case PlayerLabelEnum.PCrit:
                item.Value.text = string.Format("{0}%", roledata.lucky / 100.0f);
                break;

            case PlayerLabelEnum.MCrit:
                item.Value.text = string.Format("{0}%", roledata.mlucky / 100.0f);
                break;

            case PlayerLabelEnum.CritDamg:
                item.Value.text = string.Format("{0}%", roledata.criti_ratio / 100.0f);
                break;

            case PlayerLabelEnum.Cure:
                item.Value.text = roledata.cure.ToString();
                break;

            case PlayerLabelEnum.HitRate:
                item.Value.text = string.Format("{0}%", roledata.phit / 100.0f);
                break;

            case PlayerLabelEnum.Miss:
                item.Value.text = string.Format("{0}%", roledata.hide_per / 100.0f);
                break;

            case PlayerLabelEnum.PDamgAbsorb:
                item.Value.text = roledata.pabs.ToString();
                break;

            case PlayerLabelEnum.MDamgAbsorb:
                item.Value.text = roledata.mabs.ToString();
                break;

            case PlayerLabelEnum.DamgDeepen:
                item.Value.text = string.Format("{0}%", roledata.harm_add_per / 100.0f);
                break;

            case PlayerLabelEnum.DamgAbsorb:
                item.Value.text = string.Format("{0}%", roledata.harm_sub_per / 100.0f);
                break;

            case PlayerLabelEnum.Max:
                break;

            default:
                break;
            }
        }
    }
Ejemplo n.º 2
0
    private void OnInitProp()
    {
        m_dicLabls_Player = new Dictionary <PlayerLabelEnum, UILabel>();
        if (m_trans_propRoot != null)
        {
            int index = 1;
            int start = (int)PlayerLabelEnum.None + 1;
            int end   = (int)PlayerLabelEnum.HpMax;
            do
            {
                Transform labelRoot = m_trans_propRoot.Find("part" + index.ToString());
                if (labelRoot != null)
                {
                    PlayerLabelEnum le = PlayerLabelEnum.None;
                    for (int i = start; i < end; i++)
                    {
                        le = (PlayerLabelEnum)i;

                        Transform child = labelRoot.Find(le.ToString());
                        if (child != null)
                        {
                            UILabel lable = child.GetComponent <UILabel>();
                            if (lable != null)
                            {
                                m_dicLabls_Player.Add(le, lable);
                            }
                            else
                            {
                                Debug.LogError("GetComponent error " + le.ToString());
                            }
                        }
                        else
                        {
                            Debug.LogError("FindChild error " + le.ToString());
                        }
                    }
                }
                else
                {
                    Debug.LogError("FindChild error " + index.ToString());
                }
                start = end;

                if (index == 1)
                {
                    end = (int)PlayerLabelEnum.Power;
                }
                else if (index == 2)
                {
                    end = (int)PlayerLabelEnum.FireATK;
                }
                else if (index == 3)
                {
                    end = (int)PlayerLabelEnum.PCrit;
                }
                else if (index == 4)
                {
                    end = (int)PlayerLabelEnum.Max;
                }
                index++;
            } while (index <= 5);
        }
    }