Exemple #1
0
    void SetTiLi(PropertyType type, COM_Addprop prop)
    {
        addPoints = new float[5];

        for (int i = 0; i < propList.Count; ++i)
        {
            addPoints[0] += SimAddPoint(propList[i].type_, PropertyType.PT_Attack, propList[i]);
            addPoints[1] += SimAddPoint(propList[i].type_, PropertyType.PT_Defense, propList[i]);
            addPoints[2] += SimAddPoint(propList[i].type_, PropertyType.PT_Agile, propList[i]);
            addPoints[3] += SimAddPoint(propList[i].type_, PropertyType.PT_Reply, propList[i]);
            addPoints[4] += SimAddPoint(propList[i].type_, PropertyType.PT_Spirit, propList[i]);

            accatkLabel.text   = ((int)(Inst.GetProperty(PropertyType.PT_Attack))).ToString();
            defensekLabel.text = ((int)(Inst.GetProperty(PropertyType.PT_Defense))).ToString();
            agilitykLabel.text = ((int)(Inst.GetProperty(PropertyType.PT_Agile))).ToString();
            replyLabel.text    = ((int)(Inst.GetProperty(PropertyType.PT_Reply))).ToString();
            spiritLabel.text   = ((int)(Inst.GetProperty(PropertyType.PT_Spirit))).ToString();

            string  content    = "";
            Color   color      = Color.green;
            UILabel lbl        = null;
            int     roundToint = 0;
            int     adjust     = 0;
            for (int j = 0; j < addPoints.Length; ++j)
            {
                roundToint = (int)addPoints[j];
                switch (j)
                {
                case 0:
                    lbl    = gongjiSim;
                    adjust = (int)(addPoints[j] + Inst.GetProperty(PropertyType.PT_Attack)) - ((int)addPoints[j] + (int)Inst.GetProperty(PropertyType.PT_Attack));
                    break;

                case 1:
                    lbl    = fangyuSim;
                    adjust = (int)(addPoints[j] + Inst.GetProperty(PropertyType.PT_Defense)) - ((int)addPoints[j] + (int)Inst.GetProperty(PropertyType.PT_Defense));
                    break;

                case 2:
                    lbl    = minjieSim;
                    adjust = (int)(addPoints[j] + Inst.GetProperty(PropertyType.PT_Agile)) - ((int)addPoints[j] + (int)Inst.GetProperty(PropertyType.PT_Agile));
                    break;

                case 3:
                    lbl    = huifuSim;
                    adjust = (int)(addPoints[j] + Inst.GetProperty(PropertyType.PT_Reply)) - ((int)addPoints[j] + (int)Inst.GetProperty(PropertyType.PT_Reply));
                    break;

                case 4:
                    lbl    = jingshenSim;
                    adjust = (int)(addPoints[j] + Inst.GetProperty(PropertyType.PT_Spirit)) - ((int)addPoints[j] + (int)Inst.GetProperty(PropertyType.PT_Spirit));
                    break;
                }

                roundToint += adjust;

                if (roundToint > 0)
                {
                    content = string.Format("+{0}", roundToint);
                    color   = Color.green;
                }
                else if (roundToint < 0)
                {
                    content = string.Format("-{0}", Mathf.Abs(roundToint));
                    color   = Color.red;
                }
                else
                {
                    content = "";
                }

                lbl.text  = content;
                lbl.color = color;
            }
        }

        //if (type == PropertyType.PT_Stama)
        //{
        //    accatkLabel.text = (Inst.Properties [(int)PropertyType.PT_Attack] + SimAddPoint(type, PropertyType.PT_Attack, prop)).ToString ();
        //    defensekLabel.text = (Inst.Properties[(int)PropertyType.PT_Defense] + SimAddPoint(type, PropertyType.PT_Defense, prop)).ToString();
        //    agilitykLabel.text = (Inst.Properties[(int)PropertyType.PT_Agile] + SimAddPoint(type, PropertyType.PT_Agile, prop)).ToString();
        //    replyLabel.text = (Inst.Properties[(int)PropertyType.PT_Reply] + SimAddPoint(type, PropertyType.PT_Reply, prop)).ToString();
        //    spiritLabel.text = (Inst.Properties[(int)PropertyType.PT_Spirit] + SimAddPoint(type, PropertyType.PT_Spirit, prop)).ToString();
        //}
        //else
        //    if(type == PropertyType.PT_Strength)
        //{
        //    accatkLabel.text = (Inst.Properties [(int)PropertyType.PT_Attack] + SimAddPoint(type, PropertyType.PT_Attack, prop)).ToString ();
        //    defensekLabel.text = (Inst.Properties[(int)PropertyType.PT_Defense] + SimAddPoint(type, PropertyType.PT_Defense, prop)).ToString();
        //    agilitykLabel.text = (Inst.Properties[(int)PropertyType.PT_Agile] + SimAddPoint(type, PropertyType.PT_Agile, prop)).ToString();
        //    replyLabel.text = (Inst.Properties[(int)PropertyType.PT_Reply] + SimAddPoint(type, PropertyType.PT_Reply, prop)).ToString();
        //    spiritLabel.text = (Inst.Properties[(int)PropertyType.PT_Spirit] + SimAddPoint(type, PropertyType.PT_Spirit, prop)).ToString();
        //}
        //else
        //    if(type == PropertyType.PT_Power)
        //{
        //    accatkLabel.text = (Inst.Properties [(int)PropertyType.PT_Attack] + SimAddPoint(type, PropertyType.PT_Attack, prop)).ToString ();
        //    defensekLabel.text = (Inst.Properties[(int)PropertyType.PT_Defense] + SimAddPoint(type, PropertyType.PT_Defense, prop)).ToString();
        //    agilitykLabel.text = (Inst.Properties[(int)PropertyType.PT_Agile] + SimAddPoint(type, PropertyType.PT_Agile, prop)).ToString();
        //    replyLabel.text = (Inst.Properties[(int)PropertyType.PT_Reply] + SimAddPoint(type, PropertyType.PT_Reply, prop)).ToString();

        //}
        //else
        //    if(type == PropertyType.PT_Speed)
        //{
        //    accatkLabel.text = (Inst.Properties [(int)PropertyType.PT_Attack] + SimAddPoint(type, PropertyType.PT_Attack, prop)).ToString ();
        //    defensekLabel.text = (Inst.Properties[(int)PropertyType.PT_Defense] + SimAddPoint(type, PropertyType.PT_Defense, prop)).ToString();
        //    agilitykLabel.text = (Inst.Properties[(int)PropertyType.PT_Agile] + SimAddPoint(type, PropertyType.PT_Agile, prop)).ToString();
        //    replyLabel.text = (Inst.Properties[(int)PropertyType.PT_Reply] + SimAddPoint(type, PropertyType.PT_Reply, prop)).ToString();
        //    spiritLabel.text = (Inst.Properties[(int)PropertyType.PT_Spirit] + SimAddPoint(type, PropertyType.PT_Spirit, prop)).ToString();
        //}
        //else
        //    if(type == PropertyType.PT_Magic)
        //{
        //    accatkLabel.text = (Inst.Properties [(int)PropertyType.PT_Attack] + SimAddPoint(type, PropertyType.PT_Attack, prop)).ToString ();
        //    defensekLabel.text = (Inst.Properties[(int)PropertyType.PT_Defense] + SimAddPoint(type, PropertyType.PT_Defense, prop)).ToString();
        //    agilitykLabel.text = (Inst.Properties[(int)PropertyType.PT_Agile] + SimAddPoint(type, PropertyType.PT_Agile, prop)).ToString();
        //    replyLabel.text = (Inst.Properties[(int)PropertyType.PT_Reply] + SimAddPoint(type, PropertyType.PT_Reply, prop)).ToString();
        //    spiritLabel.text = (Inst.Properties[(int)PropertyType.PT_Spirit] + SimAddPoint(type, PropertyType.PT_Spirit, prop)).ToString();
        //}

        Shengyu.text = curDian.ToString();

        for (int i = 0; i < propList.Count; ++i)
        {
            switch (propList[i].type_)
            {
            case PropertyType.PT_Stama:
                tili.text = ((int)Inst.Properties[(int)PropertyType.PT_Stama]).ToString();
                if (propList[i].uVal_ == 0)
                {
                    tiliSim.text = "";
                }
                else
                {
                    tiliSim.text = string.Format("+{0}", propList[i].uVal_);
                }
                break;

            case PropertyType.PT_Strength:
                liliang.text = ((int)Inst.Properties[(int)PropertyType.PT_Strength]).ToString();
                if (propList[i].uVal_ == 0)
                {
                    liliangSim.text = "";
                }
                else
                {
                    liliangSim.text = string.Format("+{0}", propList[i].uVal_);
                }
                break;

            case PropertyType.PT_Power:
                Qiangdu.text = ((int)Inst.Properties[(int)PropertyType.PT_Power]).ToString();
                if (propList[i].uVal_ == 0)
                {
                    QiangduSim.text = "";
                }
                else
                {
                    QiangduSim.text = string.Format("+{0}", propList[i].uVal_);
                }
                break;

            case PropertyType.PT_Speed:
                sudu.text = ((int)Inst.Properties[(int)PropertyType.PT_Speed]).ToString();
                if (propList[i].uVal_ == 0)
                {
                    suduSim.text = "";
                }
                else
                {
                    suduSim.text = string.Format("+{0}", propList[i].uVal_);
                }
                break;

            case PropertyType.PT_Magic:
                mofa.text = ((int)Inst.Properties[(int)PropertyType.PT_Magic]).ToString();
                if (propList[i].uVal_ == 0)
                {
                    mofaSim.text = "";
                }
                else
                {
                    mofaSim.text = string.Format("+{0}", propList[i].uVal_);
                }
                break;
            }
        }
    }