Ejemplo n.º 1
0
        public static uint CheckResourceActorId(uint actorId)
        {
            string prefab = RoleHelp.GetPrefabName(actorId);

            if (prefab != "" && SGameEngine.ResourceLoader.Instance.is_exist_asset("Assets/Res/" + prefab + ".prefab") == false)
            {//资源不存在,尝试默认资源
                DBActor db = DBManager.GetInstance().GetDB <DBActor>();

                if (!db.ContainsKey(actorId))
                {
                    return(actorId);
                }

                DBActor.ActorData data = db.GetData(actorId);
                if (data.default_actor_id != 0)
                {
                    return(data.default_actor_id);
                }
                return(actorId);
            }
            else
            {
                return(actorId);
            }
        }
Ejemplo n.º 2
0
        public static bool HasExistResourceActorId(uint actorId)
        {
            string prefab = RoleHelp.GetPrefabName(actorId);

            if (prefab == null || prefab == "")
            {
                return(false);
            }
            if (prefab != "" && SGameEngine.ResourceLoader.Instance.is_exist_asset("Assets/Res/" + prefab + ".prefab"))
            {
                return(true);
            }

            //资源不存在,尝试默认资源
            DBActor db = DBManager.GetInstance().GetDB <DBActor>();

            if (!db.ContainsKey(actorId))
            {
                return(false);
            }

            DBActor.ActorData data = db.GetData(actorId);
            if (data.default_actor_id == 0 || actorId == data.default_actor_id)
            {
                return(false);
            }
            return(HasExistResourceActorId(data.default_actor_id));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 根据角色id判断是否为跨服boss
        /// </summary>
        /// <param name="actorId"></param>
        /// <param name="isLocal">是否是单服</param>
        /// <returns></returns>
        public static bool IsServerBoss(uint actorId, bool isLocal = false)
        {
            if (IsMonsterByActorId(actorId) == false)
            {
                return(false);
            }

            DBActor db = DBManager.GetInstance().GetDB(typeof(DBActor).Name) as DBActor;

            if (db.ContainsKey(actorId) == false)
            {
                GameDebug.LogError("Record does't exist. actor id:" + actorId);
                return(false);
            }
            var data = db.GetData(actorId);

            if (isLocal)
            {
                return(data.war_tag == GameConst.WAR_TAG_SPAN_BOSS_LOCAL);
            }
            else
            {
                return(data.war_tag == GameConst.WAR_TAG_SPAN_BOSS);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 通过角色表id来进行属性字段的初始化(用于LocalActorAttribure的初始化)
        /// </summary>
        /// <param name="type_id"></param>
        public void InitAttributeData(uint type_id)
        {
            //查表根据类型填充属性字段
            DBActor db = DBManager.GetInstance().GetDB <DBActor>();

            if (null == db)
            {
                GameDebug.Log("[ActorAttributeData]DBActor is null");
                return;
            }

            if (!db.ContainsKey(type_id))
            {
                GameDebug.Log("[ActorAttributeData]DBActor not exist type_id: " + type_id);
                return;
            }

            DBActor.ActorData data = db.GetData(type_id);
            Vocation            = data.vocation;
            BehaviourTree       = data.behaviour_tree + ".json";
            SummonBehaviourTree = data.summon_behaviour_tree + ".json";
            DefaultMotionRadius = data.motion_radius;
            WarTag        = data.war_tag;
            AttackRotaion = data.attack_rotaion;
            Quality       = (uint)data.color;
            Gravity       = data.gravity;

            // 设置默认属性,保证初始的攻速为1
            Attribute[GameConst.AR_ATK_SPEED_BASE].Value  = 100;
            Attribute[GameConst.AR_ATK_SPEED_ADD].Value   = 0;
            Attribute[GameConst.AR_MOVE_REAL_SPEED].Value = (uint)(data.runspeed);
        }
Ejemplo n.º 5
0
        public static bool GetIsHideSelectEffect(uint actorId)
        {
            DBActor db = DBManager.GetInstance().GetDB(typeof(DBActor).Name) as DBActor;

            if (db.ContainsKey(actorId) == false)
            {
                GameDebug.LogError("Record does't exist. actor id:" + actorId);
                return(false);
            }

            return(db.GetData(actorId).is_hide_select_effect);
        }
Ejemplo n.º 6
0
        public static uint GetDeadTimeline(uint actorId)
        {
            DBActor db = DBManager.GetInstance().GetDB(typeof(DBActor).Name) as DBActor;

            if (db.ContainsKey(actorId) == false)
            {
                GameDebug.LogError("Record does't exist. actor id:" + actorId);
                return(0);
            }

            return(db.GetData(actorId).dead_timeline);
        }
Ejemplo n.º 7
0
        public const float DisplayPercentUnitConvert = 100.00f;   //人物属性转百分比

        public static uint GetRaceIdByActorId(uint rid)
        {
            DBActor db = DBManager.GetInstance().GetDB(typeof(DBActor).Name) as DBActor;

            if (db.ContainsKey(rid) == false)
            {
                GameDebug.LogError("Record does't exist. type_id:" + rid);
                return(0);
            }

            return(db.GetData(rid).race_id);
        }
Ejemplo n.º 8
0
        public static uint GetActorLevel(uint actorId)
        {
            DBActor db = DBManager.GetInstance().GetDB(typeof(DBActor).Name) as DBActor;

            if (db.ContainsKey(actorId) == false)
            {
                GameDebug.LogError("Record does't exist. actor id:" + actorId);
                return(0);
            }
            var data = db.GetData(actorId);

            return((uint)data.level);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 通过角色id来获取角色对应的在对话框里面的摄像机旋转
        /// </summary>
        /// <param name="type_id"></param>
        /// <returns></returns>
        public static Vector3 GetPrefabCamRotateInDialogWnd(uint type_id)
        {
            DBActor db = DBManager.GetInstance().GetDB <DBActor>();

            if (!db.ContainsKey(type_id))
            {
                GameDebug.LogError(string.Format("GetPrefabCamRotateInDialogWnd Id:[{0}] don't exist", type_id));
                return(Vector3.zero);
            }

            DBActor.ActorData data = db.GetData(type_id);
            return(ModelHelper.GetModelCamRotateInDialogWnd(data.model_id));
        }
Ejemplo n.º 10
0
        public static float GetPrefabFloatScale(uint type_id)
        {
            DBActor db = DBManager.GetInstance().GetDB <DBActor>();

            if (!db.ContainsKey(type_id))
            {
                GameDebug.LogError(string.Format("GetPrefabScale Id:[{0}] don't exist", type_id));
                return(1f);
            }

            DBActor.ActorData data = db.GetData(type_id);
            return(ModelHelper.GetModelScale(data.model_id));
        }
Ejemplo n.º 11
0
        public static string GetActorName(uint actorId)
        {
            DBActor db = DBManager.GetInstance().GetDB(typeof(DBActor).Name) as DBActor;

            if (db.ContainsKey(actorId) == false)
            {
                GameDebug.LogError("Record does't exist. actor id:" + actorId);
                return(string.Empty);
            }
            var data = db.GetData(actorId);

            return(data.name);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// 通过角色id来获取角色对应的资源缩放
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public static Vector3 GetPrefabScale(xc.UnitCacheInfo info)
        {
            uint id = GetActorId(info);

            DBActor db = DBManager.GetInstance().GetDB <DBActor>();

            if (!db.ContainsKey(id))
            {
                return(Vector3.one);
            }

            float scale = ModelHelper.GetModelScale(db.GetData(id).model_id);

            return(new Vector3(scale, scale, scale));
        }
Ejemplo n.º 13
0
        /// <summary>
        /// 根据角色id判断是否为世界boss
        /// </summary>
        /// <param name="actorId"></param>
        /// <returns></returns>
        public static bool IsWorldBoss(uint actorId)
        {
            if (IsMonsterByActorId(actorId) == false)
            {
                return(false);
            }
            DBActor db = DBManager.GetInstance().GetDB(typeof(DBActor).Name) as DBActor;

            if (db.ContainsKey(actorId) == false)
            {
                GameDebug.LogError("Record does't exist. actor id:" + actorId);
                return(false);
            }
            var data = db.GetData(actorId);

            return(data.war_tag == GameConst.WAR_TAG_WORLD_BOSS);
        }
Ejemplo n.º 14
0
        /// <summary>
        /// 根据角色id判断是否为boss
        /// </summary>
        /// <param name="actorId"></param>
        /// <returns></returns>
        public static bool IsBoss(uint actorId)
        {
            if (IsMonsterByActorId(actorId) == false)
            {
                return(false);
            }
            DBActor db = DBManager.GetInstance().GetDB(typeof(DBActor).Name) as DBActor;

            if (db.ContainsKey(actorId) == false)
            {
                GameDebug.LogError("Record does't exist. actor id:" + actorId);
                return(false);
            }
            var data = db.GetData(actorId);

            return(data.color == Monster.QualityColor.BOSS);
        }
Ejemplo n.º 15
0
        /// <summary>
        /// 通过角色id来获取角色对应的角色头像
        /// </summary>
        /// <param name="type_id"></param>
        /// <returns></returns>
        public static string GetRoleIcon(uint type_id)
        {
            DBActor db = DBManager.GetInstance().GetDB <DBActor>();

            if (!db.ContainsKey(type_id))
            {
                GameDebug.LogError(string.Format("GetRoleIcon Id:[{0}] don't exist", type_id));
                return("");
            }

            DBActor.ActorData data = db.GetData(type_id);
            string            icon = ModelHelper.GetModelIcon(data.model_id);

            if (icon.Length == 0)
            {
                return(string.Empty);
            }

            return(icon);
        }
Ejemplo n.º 16
0
        /// <summary>
        /// 通过角色id来获取角色对应的资源名字
        /// </summary>
        public static string GetPrefabName(xc.UnitCacheInfo info)
        {
            uint id = GetActorId(info);

            DBActor db = DBManager.GetInstance().GetDB <DBActor>();

            if (!db.ContainsKey(id))
            {
                return(string.Empty);
            }

            string name = ModelHelper.GetModelPrefab(db.GetData(id).model_id, info.IsUIModel);

            if (name.Length == 0)
            {
                return(string.Empty);
            }

            return(name);
        }
Ejemplo n.º 17
0
        /// <summary>
        /// 根据角色表id来获取角色的名字
        /// </summary>
        public static string GetActorName(uint type_id)
        {
            DBActor db = DBManager.GetInstance().GetDB <DBActor>();

            if (!db.ContainsKey(type_id))
            {
                GameDebug.LogError(string.Format("GetActorName Id:[{0}] don't exist", type_id));
                return("");
            }

            DBActor.ActorData data = db.GetData(type_id);
            string            name = data.name;

            if (name.Length == 0)
            {
                return("");
            }

            return(name);
        }
Ejemplo n.º 18
0
        /// <summary>
        /// 通过角色id来获取角色对应的资源名字
        /// </summary>
        public static string GetPrefabName(uint type_id, bool is_local_player = false)
        {
            DBActor db = DBManager.GetInstance().GetDB <DBActor>();

            if (!db.ContainsKey(type_id))
            {
                GameDebug.LogError(string.Format("GetPreFabName Id:[{0}] don't exist", type_id));
                return("");
            }

            DBActor.ActorData data = db.GetData(type_id);
            string            name = ModelHelper.GetModelPrefab(data.model_id, is_local_player);

            if (name.Length == 0)
            {
                return(string.Empty);
            }

            return(name);
        }
Ejemplo n.º 19
0
        /// <summary>
        /// 根据角色id判断是否为怪
        /// </summary>
        /// <param name="actorId"></param>
        /// <returns></returns>
        public static bool IsMonsterByActorId(uint actorId)
        {
            DBActor db = DBManager.GetInstance().GetDB(typeof(DBActor).Name) as DBActor;

            if (db.ContainsKey(actorId) == false)
            {
                GameDebug.LogError("Record does't exist. actor id:" + actorId);
                return(false);
            }
            var data     = db.GetData(actorId);
            var UnitType = (EUnitType)data.type;

            if (UnitType == EUnitType.UNITTYPE_MONSTER)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 20
0
        public static string GetDeadNotify(uint actorId)
        {
            DBActor db = DBManager.GetInstance().GetDB(typeof(DBActor).Name) as DBActor;

            if (db.ContainsKey(actorId) == false)
            {
                GameDebug.LogError("Record does't exist. actor id:" + actorId);
                return(string.Empty);
            }

            var notify_notice = db.GetData(actorId).dead_notify;

            if (notify_notice != null)
            {
                return(System.Text.Encoding.UTF8.GetString(notify_notice));
            }
            else
            {
                return(string.Empty);
            }
        }