Beispiel #1
0
    public void InitRenderTextureObj()
    {
        if (m_widget_PetMessageShuXing == null)
        {
            return;
        }

        PetMessage message = m_widget_PetMessageShuXing.gameObject.GetComponent <PetMessage>();

        if (message == null)
        {
            message = m_widget_PetMessageShuXing.gameObject.AddComponent <PetMessage>();
        }
        if (message != null)
        {
            PetDataBase db = null;
            if (petDataManager.CurPet != null)
            {
                db = petDataManager.GetPetDataBase(petDataManager.CurPet.PetBaseID);
            }
            message.InitPetTexture(db);
        }
    }
Beispiel #2
0
    public void InitPetDataBase(PetDataBase db)
    {
        if (db == null)
        {
            Log.Error(" db is null");
            return;
        }
        _database = db;
        PetMessage mesage = m_widget_PetMessage.GetComponent <PetMessage>();

        if (mesage == null)
        {
            mesage = m_widget_PetMessage.gameObject.AddComponent <PetMessage>();
        }
        mesage.InitPetTexture(db);
        m_label_score.text = db.petScore.ToString();
        int  itemCount = DataManager.Manager <ItemManager>().GetItemNumByBaseId(db.fragmentID);
        uint needNum   = db.fragmentNum;

        m_nItemCount = (uint)itemCount;
        m_nNeedCount = (uint)needNum;
        Transform trans = m_slider_suipian_scorllbar.transform.Find("Percent");

        string str = itemCount + "/" + needNum;

        float scale = itemCount * 1.0f / needNum;

        m_slider_suipian_scorllbar.value = scale;
        if (itemCount >= needNum)
        {
            str = StringUtil.GetNumNeedString(itemCount, needNum);
            UILabel label = trans.GetComponent <UILabel>();
            if (label != null)
            {
                label.color = Color.green;
            }
        }
        else
        {
            if (trans != null)
            {
                UILabel label = trans.GetComponent <UILabel>();
                if (label != null)
                {
                    label.color = Color.white;
                }
            }
        }
        UILabel numLabel = trans.GetComponent <UILabel>();

        if (numLabel != null)
        {
            numLabel.text = str;
        }
        m_label_showname.text     = db.petName;
        m_label_xiedaidengji.text = db.carryLevel.ToString();
        m_label_leixing.text      = petDataManger.GetPetStrType(db);

        m_label_getway.text = db.getPath;
        UIItem.AttachParent(m_sprite_btn_huoqu.transform, (uint)db.getItemID, callback: GetWayCallBack, showGetWay: true);

        string talent = db.PetTalent;

        string[] zizhiArray = talent.Split(';');
        string[] strArray   = zizhiArray[0].Split('_');
        m_label_liliang.text = strArray[strArray.Length - 1];
        string[] minjieArray = zizhiArray[1].Split('_');
        m_label_minjie.text = minjieArray[minjieArray.Length - 1];

        string[] zhiliArray = zizhiArray[2].Split('_');
        m_label_zhili.text = zhiliArray[zhiliArray.Length - 1];

        string[] tiliArray = zizhiArray[3].Split('_');
        m_label_tili.text = tiliArray[tiliArray.Length - 1];

        string[] jingshenArray = zizhiArray[4].Split('_');
        m_label_jingshen.text = jingshenArray[jingshenArray.Length - 1];
    }