Пример #1
0
        public static void AttachDress(uint presentid, GameObject go)
        {
            var    dData   = XDestructionLibrary.GetPartsInfo(presentid);
            var    present = XAnimationLibrary.AssociatedAnimations(presentid);
            XParts xpart   = go.GetComponent <XParts>();

            if (dData != null && dData.Length > 0)
            {
                SkinnedMeshRenderer[] renders = new SkinnedMeshRenderer[dData.Length];
                for (int i = 0; i < dData.Length; i++)
                {
                    var t = go.transform.Find(dData[i].PerfectPart);
                    if (t == null)
                    {
                        Debug.LogError("DestructionPart config error: " + presentid + " perfectpart: " + dData[i].PerfectPart); continue;
                    }
                    renders[i] = t.GetComponent <SkinnedMeshRenderer>();
                }
                InitWithPerfectPart(dData, "Assets/BundleRes/FBXRawData/" + present.Prefab + "/", renders, xpart);
            }
            else
            {
                XFashionLibrary.DrawRoleWithPresentID(presentid, go);
            }
        }
Пример #2
0
        private void CreateAvatar()
        {
            XEditorUtil.ClearCreatures();

            List <int> list  = new List <int>();
            var        table = XFashionLibrary._profession.Table;

            presentid = table.Where(x => x.Shape == (int)shape).Select(x => x.PresentID).First();
            string path   = "Assets/BundleRes/Prefabs/Player_" + shape.ToString().ToLower() + ".prefab";
            var    prefab = AssetDatabase.LoadAssetAtPath <GameObject>(path);

            if (prefab != null)
            {
                GameObject root = GameObject.Find("Player");
                if (root == null)
                {
                    root = new GameObject("Player");
                    root.transform.position = new Vector3(0f, 0f, -8f);
                }
                go = Instantiate(prefab);
                go.transform.SetParent(root.transform);
                go.name = shape.ToString();
                go.transform.localScale    = Vector3.one;
                go.transform.rotation      = Quaternion.Euler(0, 180, 0);
                go.transform.localPosition = Vector3.zero;
                Selection.activeGameObject = go;
                fashionInfo    = XFashionLibrary.GetFashionsInfo(shape);
                fashionDesInfo = new string[fashionInfo.Length];
                for (int i = 0; i < fashionInfo.Length; i++)
                {
                    fashionDesInfo[i] = fashionInfo[i].name;
                }
            }
        }
Пример #3
0
        public static void DrawFace(GameObject go, RoleShape shape, string suffix, Transform[] bones, uint presentid)
        {
            string    sshape    = shape.ToString().ToLower();
            Transform transf    = go.transform.Find("Player_" + sshape + "_" + TCConst.FACE);
            string    shape_dir = "Player_" + sshape;
            var       row       = XFashionLibrary.FindRole(presentid);

            if (row != null)
            {
                string cname = "Player_" + sshape + "_common_" + TCConst.FACE + "_" + row.ID;
                string asset = "Assets/BundleRes/FBXRawData/" + shape_dir + "/Common/" + cname;
                DrawPart(transf, asset, bones, null, null);
            }
            else
            {
                Debug.LogError("not find present id in profession table, " + presentid);
            }
        }