Exemple #1
0
        public Role(int id)
        {
            table = Table <tRole> .Find(id);

            Log.ErrorIf(table == null, $"找不到 RoleTable :{id}");
            this.id = id;
            guid    = Funcs.NewGuid();
            skinId  = table.skinIds[0];

            skin = Table <tSkin> .Find(skinId);

            avatar = new Avatar(SceneManager.roleRoot, skin.skeleton, skin.skin, AfterRoleLoadFinish);
            avatar.gameObject.name = id + "_" + guid;

            act = new ActController(this);

            move = new MoveController(avatar.gameObject.transform);
            move.onMoveFinished = OnMoveFinished;
            move.onMoveStart    = OnMoveStart;

            //加载动画
            AssetMgr.Instance.LoadAsync(skin.animDir + "/Walk.anim", (anim) => {
                animWalk = anim as AnimationClip;
            });
            AssetMgr.Instance.LoadAsync(skin.animDir + "/Stand.anim", (anim) => {
                animStand = anim as AnimationClip;
                AfterRoleLoadFinish();
            });
            LoadAnimationClips(act.actCombos);
        }
Exemple #2
0
        public void PlayAct(ActType actType)
        {
            Act act = null;

            if (curAct != null && curAct.next != null)
            {
                foreach (var a in curAct.next)
                {
                    if (a.table.type == (int)actType)
                    {
                        act = a;
                        break;
                    }
                }
            }
            if (act == null)
            {
                foreach (var a in actCombos)
                {
                    if (a.table.type == (int)actType)
                    {
                        act = a;
                        break;
                    }
                }
            }
            Log.ErrorIf(act == null, $"Not Found Act {actType}");
            curAct = act;
            if (role.move.IsMoving)
            {
                role.move.StopMove();
            }
            Log.ErrorIf(act.anim == null, $"Not Found Act anim {act.table.anim},{act}");
            role.avatar.AnimCtrl.PlayAnimation(act.anim, null);
        }
Exemple #3
0
        public static SceneObject CreateScene(int sceneId)
        {
            var table = Table <tScene> .Find(sceneId);

            Log.ErrorIf(table == null, $"not Found Scene: {sceneId}");
            return(new SceneObject(table));
        }
Exemple #4
0
        public static void Init()
        {
            var ui = GameObject.Find("Canvas");

            Log.ErrorIf(!ui, "not found Canvas");
            _root = ui.transform;
            InitLayer();
            UIConfig.LoadUIConfig();
        }
Exemple #5
0
        public static SkinMeta GetMeta(string path, GameObject go)
        {
            if (_skinMetas.TryGetValue(path, out SkinMeta meta))
            {
                return(meta);
            }
            var serialize = go.GetComponent <SerializeData>();

            Log.ErrorIf(serialize == null, $"Not Found SerializeData in {go.name}");
            meta = serialize.Deserialize <SkinMeta>();
            Log.Info(JsonConvert.SerializeObject(meta.bones));
            _skinMetas[path] = meta;
            return(meta);
        }
Exemple #6
0
        public Act(int id)
        {
            table = Table <tAct> .Find(id);

            Log.ErrorIf(table == null, $"{id} is not in ActTable");
            if (table.next != null)
            {
                var len = table.next.Length;
                next = new Act[len];
                for (var i = 0; i < len; ++i)
                {
                    next[i] = new Act(table.next[i]);
                }
            }
            level = table.type == (int)ActType.Attack ? 1 : 0;
            //AssetMgr.Instance.LoadAsync(table.anim, (asset) => { anim = asset as AnimationClip; });
        }