Exemple #1
0
            /// <summary>
            /// 获取指定角色id的boss信息
            /// </summary>
            /// <param name="actor_id"></param>
            /// <returns></returns>
            public static RedefineBossInfo GetPkgBossInfoByActorId(uint actor_id)
            {
                // 世界BOSS体验副本伪造一个PkgBossInfo数据
                if (SceneHelp.Instance.IsInWorldBossExperienceInstance == true)
                {
                    RedefineBossInfo bossInfo = new RedefineBossInfo();

                    //Dictionary<UnitID, Actor> bossList = ActorManager.Instance.GetMonsterSetByActorId(actor_id);
                    //UnitID bossUuid = null;
                    //foreach (UnitID uuid in bossList.Keys)
                    //{
                    //    bossUuid = uuid;
                    //}
                    //Actor bossActor = ActorManager.Instance.GetActor(bossUuid);
                    // mBossKillTime大于0表示boss已经死了
                    if (mBossKillTime > 0)
                    {
                        byte[] localPlayerName     = System.Text.Encoding.UTF8.GetBytes(Game.Instance.LocalPlayerName);
                        uint   localPlayerVocation = LocalPlayerManager.Instance.LocalActorAttribute.Vocation;
                        bossInfo.state        = 0;
                        bossInfo.refresh_time = mBossKillTime + 60;
                        bossInfo.killers.Clear();
                        RedefineBossKiller killer = new RedefineBossKiller();
                        killer.time      = mBossKillTime;
                        killer.name      = localPlayerName;
                        killer.team_id   = TeamManager.Instance.TeamId;
                        killer.rid       = localPlayerVocation;
                        killer.aff_names = new List <byte[]> {
                            localPlayerName
                        };
                        bossInfo.killers.Add(killer);
                    }
                    else
                    {
                        bossInfo.state = 1;
                    }

                    return(bossInfo);
                }
                else
                {
                    if (mBossInfoAll == null)
                    {
                        return(null);
                    }

                    foreach (var boss_info in mBossInfoAll)
                    {
                        var data_special_mon = DBManager.Instance.GetDB <DBSpecialMon>().GetData(boss_info.id);
                        if (data_special_mon != null && data_special_mon.ActorId == actor_id)
                        {
                            return(boss_info);
                        }
                    }

                    return(null);
                }
            }
Exemple #2
0
                public static RedefineBossInfo GetInfo(PkgBossInfo pkg_info)
                {
                    if (pkg_info == null)
                    {
                        return(null);
                    }
                    RedefineBossInfo protocol_info = new RedefineBossInfo();

                    protocol_info.id           = pkg_info.id;
                    protocol_info.state        = pkg_info.state;
                    protocol_info.refresh_time = pkg_info.refresh_time;

                    if (pkg_info.pos != null)
                    {
                        protocol_info.pos    = new RedefinePos();
                        protocol_info.pos.px = pkg_info.pos.px;
                        protocol_info.pos.py = pkg_info.pos.py;
                    }
                    else
                    {
                        protocol_info.pos = null;
                    }
                    protocol_info.killers.Clear();
                    if (pkg_info.killers != null)
                    {
                        for (int index = 0; index < pkg_info.killers.Count; ++index)
                        {
                            var tmp_killer            = pkg_info.killers[index];
                            RedefineBossKiller killer = new RedefineBossKiller();
                            killer.time      = tmp_killer.time;
                            killer.name      = tmp_killer.name;
                            killer.team_id   = tmp_killer.team_id;
                            killer.rid       = tmp_killer.rid;
                            killer.aff_names = tmp_killer.aff_names;
                            protocol_info.killers.Add(killer);
                        }
                    }
                    return(protocol_info);
                }