Esempio n. 1
0
    public void InsertItemInfo(int itemID, string name, E_COSTUME_TYPE _type, string info, string path, E_AVATA_TYPE avtaType, int materialID)
    {
        ItemInfo newItem = new ItemInfo(itemID, name, _type, info, path, avtaType, materialID);

        Debug.Log(itemID + " , " + name + " , " + _type + " , " + info + " , " + path);
        InsertItemInfo(newItem);
    }
Esempio n. 2
0
    void OnLoadAllParts(CostumeSetInfo setInfo)
    {
        if (setInfo == null)
        {
            return;
        }

        E_COSTUME_TYPE type = E_COSTUME_TYPE.HAIR;

        for (; type < E_COSTUME_TYPE.END; ++type)
        {
            int      costumeID;
            ItemInfo info;

            if (setInfo.dic.TryGetValue(type, out costumeID))
            {
                info = CostumeDataManager.Instance.GetItemInfo(costumeID);
            }
            else
            {
                info = CostumeDataManager.Instance.GetPartsData(type);
            }

            if (info == null)
            {
                continue;
            }

            ChangePart(m_myCharacter, info);
        }
    }
Esempio n. 3
0
    public List <ItemInfo> GetAllCostumeItemByType(E_COSTUME_TYPE costume)
    {
        List <ItemInfo> list;

        if (m_dicItemTableByType.TryGetValue(costume, out list))
        {
            return(list);
        }
        return(null);
    }
Esempio n. 4
0
    public List <GameObject> GetPartsObjectList(E_COSTUME_TYPE _Type)
    {
        List <GameObject> obj;

        if (m_myCostumeData.TryGetValue(_Type, out obj))
        {
            return(obj);
        }

        return(null);
    }
Esempio n. 5
0
 public ItemInfo(int itemID, string itemName, E_COSTUME_TYPE type, string info, string resourcePath, E_AVATA_TYPE avataType, int materialID, E_ITEMRANK itemRank = E_ITEMRANK.NORMAL, int price = 1500)
 {
     ItemID           = itemID;
     cosutumeType     = type;
     Info             = info;
     ItemName         = itemName;
     itemResourcePath = resourcePath;
     this.avataType   = avataType;
     this.materialID  = materialID;
     this.itemRank    = itemRank;
     Price            = price;
 }
Esempio n. 6
0
 public void SetPartsObject(E_COSTUME_TYPE _Type, GameObject _Obj)
 {
     if (m_myCostumeData.ContainsKey(_Type))
     {
         m_myCostumeData[_Type].Add(_Obj);
     }
     else
     {
         List <GameObject> list = new List <GameObject>();
         list.Add(_Obj);
         m_myCostumeData.Add(_Type, list);
     }
 }
Esempio n. 7
0
    public void DeleteCurrentParts(E_COSTUME_TYPE _Type)
    {
        var go = GetPartsObjectList(_Type);

        if (go != null)
        {
            for (int i = 0; i < go.Count; i++)
            {
                Destroy(go[i]);
            }

            m_myCostumeData.Remove(_Type);
        }
        else
        {
        }
    }
Esempio n. 8
0
    public ItemInfo GetPartsData(E_COSTUME_TYPE _Type)
    {
        ItemInfo obj;

        if (m_myCostumeData.TryGetValue(_Type, out obj))
        {
            return(obj);
        }

        CostumeSetInfo info = GetCostumeSetInfo();

        int itemID;

        if (info.dic.TryGetValue(_Type, out itemID))
        {
            return(GetItemInfo(itemID));
        }

        return(null);
    }
Esempio n. 9
0
    void ChangeColor(E_COSTUME_TYPE _Type, int _TextureID = 0, int _SharedTextureID = 0)
    {
        if (_TextureID == 0 && _SharedTextureID == 0)
        {
            return;
        }

        Texture ColorTex = ResourceManager.Instance.GetTexture(_TextureID);

        switch (_Type)
        {
        case E_COSTUME_TYPE.HAIR:
        case E_COSTUME_TYPE.HAIRCOLOR:
        {
            List <GameObject> list = GetPartsObjectList(E_COSTUME_TYPE.HAIR);

            if (list != null && list.Count > 0)
            {
                for (int i = 0; i < list.Count; i++)
                {
                    if (list[i] == null)
                    {
                        continue;
                    }

                    SkinnedMeshRenderer hair = list[i].GetComponent <SkinnedMeshRenderer>();

                    if (hair != null)
                    {
                        SetColor(hair, ColorTex, "hair");
                    }
                }
            }

            SetColor(m_FaceRenderer, ColorTex, "hair");
        }
        break;

        case E_COSTUME_TYPE.SKINCOLOR:
        case E_COSTUME_TYPE.COSTUME:
        {
            for (E_COSTUME_TYPE i = E_COSTUME_TYPE.NONE; i < E_COSTUME_TYPE.END; ++i)
            {
                if (i == E_COSTUME_TYPE.HAIRCOLOR || i == E_COSTUME_TYPE.HAIR)
                {
                    continue;
                }

                List <GameObject> list = GetPartsObjectList(i);

                if (list != null)
                {
                    for (int j = 0; j < list.Count; j++)
                    {
                        SetColor(list[j].GetComponent <SkinnedMeshRenderer>(), ColorTex, "body");
                    }
                }
            }
            SetColor(m_HeadRenderer, ColorTex, "body");
        }
        break;

        default:
        {
            List <GameObject> list = GetPartsObjectList(_Type);

            for (int i = 0; i < list.Count; i++)
            {
                string matname = "";
                switch (_Type)
                {
                case E_COSTUME_TYPE.HAIR:
                    matname = "hair";
                    break;

                case E_COSTUME_TYPE.CHEST:
                    matname = "chest";
                    break;

                case E_COSTUME_TYPE.BOTTOM:
                    matname = "leg";
                    break;

                case E_COSTUME_TYPE.ARM:
                    matname = "arm";
                    break;

                case E_COSTUME_TYPE.FOOT:
                    matname = "foot";
                    break;
                }
                Texture skincolor = ResourceManager.Instance.GetTexture(_SharedTextureID);

                SetColor(list[i].GetComponent <SkinnedMeshRenderer>(), skincolor, "body");

                if (ColorTex)
                {
                    SetColor(list[i].GetComponent <SkinnedMeshRenderer>(), ColorTex, matname);
                }
            }

            break;
        }
        }
    }
Esempio n. 10
0
 public void insertItem(E_COSTUME_TYPE type, int info)
 {
     dic.Add(type, info);
 }