Beispiel #1
0
        public void Init()
        {
            combineConfig = FbxEditor.GetConfig();
            TempEquipSuit fashions = new TempEquipSuit();

            m_FashionList = new List <EquipPart>();
            m_EquipList   = new List <EquipPart>();
            var fashionsuit = XTableMgr.GetTable <FashionSuit>();

            for (int i = 0, max = fashionsuit.length; i < max; ++i)
            {
                FashionSuit.RowData row = fashionsuit[i];
                if (row.FashionID != null)
                {
                    XEquipUtil.MakeEquip(row.SuitName, row.FashionID, m_FashionList, fashions, (int)row.SuitID);
                }
            }
            var equipsuit = XTableMgr.GetTable <EquipSuit>();

            for (int i = 0; i < equipsuit.length; ++i)
            {
                EquipSuit.RowData row = equipsuit[i];
                if (row.EquipID != null)
                {
                    XEquipUtil.MakeEquip(row.SuitName, row.EquipID, m_EquipList, fashions, -1);
                }
            }
        }
Beispiel #2
0
    private void TestAvatar()
    {
        role = XEntityMgr.singleton.CreateTestRole();
        role.EntityObject.AddComponent <XRotation>();

        //时装
        TempEquipSuit fashions = new TempEquipSuit();

        m_FashionList = new List <EquipPart>();
        var fashionsuit = XTableMgr.GetTable <FashionSuit>();

        for (int i = 0, max = fashionsuit.length; i < max; ++i)
        {
            FashionSuit.RowData row = fashionsuit[i];
            if (row.FashionID != null)
            {
                XEquipUtil.MakeEquip(row.SuitName, row.FashionID, m_FashionList, fashions, (int)row.SuitID);
            }
        }

        //装备
        m_EquipList = new List <EquipPart>();
        var equipsuit = XTableMgr.GetTable <EquipSuit>();

        for (int i = 0, max = equipsuit.length; i < max; ++i)
        {
            EquipSuit.RowData row = equipsuit[i];
            if (row.EquipID != null)
            {
                XEquipUtil.MakeEquip(row.SuitName, row.EquipID, m_EquipList, fashions, -1);
            }
        }
    }
Beispiel #3
0
    public override void OnInitial(XEntity enty)
    {
        base.OnInitial(enty);
        XEntity e = enty;

        //时装
        TempEquipSuit fashions = new TempEquipSuit();

        m_FashionList = new List <EquipPart>();
        var fashionsuit = XTableMgr.GetTable <FashionSuit>();

        for (int i = 0, max = fashionsuit.length; i < max; ++i)
        {
            FashionSuit.RowData row = fashionsuit[i];
            if (row.FashionID != null)
            {
                XEquipUtil.MakeEquip(row.SuitName, row.FashionID, m_FashionList, fashions, (int)row.SuitID);
            }
        }

        //装备
        m_EquipList = new List <EquipPart>();
        var equipsuit = XTableMgr.GetTable <EquipSuit>();

        for (int i = 0, max = equipsuit.length; i < max; ++i)
        {
            EquipSuit.RowData row = equipsuit[i];
            if (row.EquipID != null)
            {
                XEquipUtil.MakeEquip(row.SuitName, row.EquipID, m_EquipList, fashions, -1);
            }
        }

        Transform skinmesh = e.EntityObject.transform;

        skin = skinmesh.GetComponent <SkinnedMeshRenderer>();
        if (skin == null)
        {
            skin = skinmesh.gameObject.AddComponent <SkinnedMeshRenderer>();
        }
        skin.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.On;
        e.skin = skin;

        for (EPartType part = EPartType.ECombinePartStart; part < EPartType.ECombinePartEnd; ++part)
        {
            parts[(int)part] = new PartLoadTask(part, this);
        }
        for (EPartType part = EPartType.ECombinePartEnd; part < EPartType.EMountEnd; ++part)
        {
            parts[(int)part] = new MountLoadTask(part, this);
        }
        RegisterEvent(XEventDefine.XEvent_Detach_Host, OnDetachHost);

        EquipPart(m_FashionList[0]);
    }
Beispiel #4
0
    public static void MakeEquip(string name, int[] fashionIDs, List <EquipPart> equipList, TempEquipSuit tmpFashionData, int suitID)
    {
        FashionList fashionList = XTableMgr.GetTable <FashionList>();

        if (fashionIDs != null)
        {
            tmpFashionData.hash = 0;
            tmpFashionData.data.Clear();
            bool threePart = false;
            for (int i = 0; i < fashionIDs.Length; ++i)
            {
                int fashionID           = fashionIDs[i];
                FashionList.RowData row = fashionList.GetByUID(fashionID);
                if (row != null)
                {
                    List <ThreePart> tpLst = new List <ThreePart>();
                    if (row.EquipPos == 7 || row.EquipPos == 8 || row.EquipPos == 9)
                    {
                        ThreePart tp = FindThreePart(suitID, tpLst);
                        if (row.EquipPos == 9)
                        {
                            tp.part[2] = row.ModelPrefabArcher;
                        }
                        threePart = true;
                    }
                    else
                    {
                        if (row.ReplaceID != null && row.ReplaceID.Length > 1)
                        {
                            FashionList.RowData replace = fashionList.GetByUID(row.ReplaceID[1]);
                            if (replace != null)
                            {
                                if (replace.EquipPos == row.EquipPos)
                                {
                                    row = replace;
                                }
                            }
                        }
                        string path = row.ModelPrefabArcher;
                        if (!string.IsNullOrEmpty(path))
                        {
                            Hash(ref tmpFashionData.hash, path);
                            TempEquipData data = new TempEquipData();
                            data.row  = row;
                            data.path = path;
                            tmpFashionData.data.Add(data);
                        }
                    }
                }
            }
            if (threePart)
            {
                return;
            }

            bool          findSame = false;
            TempEquipSuit suit     = tmpFashionData;
            if (suit.hash == 0)
            {
                return;
            }
            for (int j = 0; j < equipList.Count; ++j)
            {
                EquipPart part = equipList[j];
                if (part != null && part.hash == suit.hash)
                {
                    part.suitName.Add(name);
                    findSame = true;
                    break;
                }
            }
            if (!findSame)
            {
                EquipPart part = new EquipPart();
                part.hash = suit.hash;
                part.suitName.Add(name);
                for (int j = 0; j < suit.data.Count; ++j)
                {
                    TempEquipData data    = suit.data[j];
                    int           partPos = ConvertPart(data.row.EquipPos);
                    if (partPos < part.partPath.Length)
                    {
                        part.partPath[partPos] = data.path;
                    }
                    else if (partPos == part.partPath.Length)
                    {
                        part.mainWeapon = data.path;
                    }
                }
                equipList.Add(part);
            }
        }
    }