Exemple #1
0
        private bool mInited = false; //是否已经初始化

        /// <summary>
        /// 增加地图元素
        /// </summary>
        /// <param name="entity"></param>
        private void AddMapElement(UInt64 guid, EntityCampTypeEnum type, float x, float y, float z)
        {
            if (!mInited)//如果已经初始化完成
            {
                return;
            }

            int index = (int)type;// 获取添加元素的阵营类型

            if (index <= (int)EntityCampTypeEnum.Null)
            {
                return;                                     //判断阵营是否是空
            }
            UIMiniMapElement element = GetMapElement(guid); //从mMapElementDic中获取地图元素

            if (element == null)
            {
                element = CreateMapElement(guid, type, x, y, z);//创建地图元素图标
                if (element == null)
                {
                    return;
                }

                mMapElementDic.Add(guid, element);

                EventCenter.Broadcast((Int32)GameEventEnum.GameEvent_ChangeMapState);
            }
        }
Exemple #2
0
        /// <summary>
        /// 创建地图元素图标
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        private UIMiniMapElement CreateMapElement(UInt64 guid, EntityCampTypeEnum type, float x, float y, float z)
        {
            string path = null;

            bool blueTeam = true;

            if (PlayerManager.Instance.LocalPlayer != null && type != PlayerManager.Instance.LocalPlayer.EntityCamp)
            {
                blueTeam = false;
            }

            IEntity entity = EntityManager.AllEntitys[guid];

            if (entity.entityType == EntityTypeEnum.Player)
            {
                path = GetPlayerElementPath(blueTeam);//获取蓝方或者红方图片路径
            }
            else if (entity.IfNPC())
            {
                path = GetNpcElementPath(entity, blueTeam);//获取NPC元素路径
            }
            if (string.IsNullOrEmpty(path))
            {
                return(null);
            }
            return(LoadElementResource(path, guid, x, y, z));//加载与元素资源并返回此元素
        }
Exemple #3
0
 public BattleInfo(UInt64 icon, string name, int level, int kills, int death, EntityCampTypeEnum camp)
 {
     PlayerIcon  = icon;
     PlayerName  = name;
     PlayerLevel = level;
     PlayerKills = kills;
     PlayerDeath = death;
     PlayerCamp  = camp;
 }
Exemple #4
0
        public bool IsSameCamp(EntityCampTypeEnum camp)
        {
            int campIndex  = (int)camp % 2;
            int campIndex2 = (int)EntityCamp % 2;

            if (campIndex == campIndex2)
            {
                return(true);
            }
            return(false);
        }
Exemple #5
0
 public string GetGUIDName(UInt64 icon, EntityCampTypeEnum camp)
 {
     foreach (BattleInfo battle in AllBlueTeam)
     {
         if (icon == battle.PlayerIcon)
         {
             return(battle.PlayerName);
         }
     }
     return(null);
 }
 public static IEntity GetHomeBase(EntityCampTypeEnum type)
 {
     foreach (var item in homeBaseList)
     {
         if (item.IsSameCamp(type))
         {
             return(item);
         }
     }
     return(null);
 }
Exemple #7
0
 public Dictionary <UInt64, HeroBattleInfo> GetCamp(EntityCampTypeEnum type)
 {
     if (type == EntityCampTypeEnum.A)
     {
         return(AllBlueHeroBattle);
     }
     else if (type == EntityCampTypeEnum.B)
     {
         return(AllRedHeroBattle);
     }
     return(null);
 }
Exemple #8
0
 public ISelfPlayer(UInt64 sGUID, EntityCampTypeEnum campType)
     : base(sGUID, campType)
 {
     UserGameItems         = new Dictionary <int, int>();
     UserGameItemsCount    = new Dictionary <int, int>();
     UserGameItemsCoolDown = new Dictionary <int, float>();
     for (int ct = 0; ct < 6; ct++)
     {
         UserGameItems.Add(ct, 0);
         UserGameItemsCount.Add(ct, 0);
         UserGameItemsCoolDown.Add(ct, 0f);
     }
 }
 public void Init(UInt64 objGUID, int headID, string nickName, int level, int kills, int death, int asstimes, int totalcp, int lasthit, EntityCampTypeEnum camp)
 {
     mObjGUID  = objGUID;
     mHeadID   = headID;
     mNickName = nickName;
     mLevel    = level;
     mKills    = kills;
     mDeath    = death;
     mAsstimes = asstimes;
     mTotalcp  = totalcp;
     mLasthit  = lasthit;
     mCamp     = camp;
 }
Exemple #10
0
        /// <summary>
        /// 更新地图元素
        /// </summary>
        /// <param name="entity"></param>
        private void UpdateMapElement(UInt64 guid, EntityCampTypeEnum type, float x, float y, float z)
        {
            int index = (int)type;                     //获取实体阵营类型

            if (index <= (int)EntityCampTypeEnum.Kind) //全敌对,全和平类型元素不更新
            {
                return;
            }
            UIMiniMapElement element = GetMapElement(guid);//获得Ientity所对应的地图元素  从mMapElementDic获取

            if (element != null)
            {
                element.UpdatePosDirect(x, y, z);// 将对象直接设置到目标点
            }
        }
        /// <summary>
        /// 获取阵营类型
        /// </summary>
        /// <param name="campId"></param>
        /// <returns></returns>
        public static EntityCampTypeEnum GetEntityCamp(int campId)
        {
            EntityCampTypeEnum type = (EntityCampTypeEnum)campId;

            if (campId > 0)
            {
                if (campId % 2 == 0)
                {
                    type = EntityCampTypeEnum.B;
                }
                else
                {
                    type = EntityCampTypeEnum.A;
                }
            }
            return(type);
        }
Exemple #12
0
        }                                              //战况  平手,失败,胜利


        //创建实例(英雄)  英雄ID   英雄阵营
        public override IEntity HandleCreateEntity(UInt64 sGUID, EntityCampTypeEnum campType)
        {
            //entity id
            IPlayer player;

            if (GameUserModel.Instance.IsLocalPlayer(sGUID))
            {
                player = new ISelfPlayer(sGUID, campType);
            }
            else
            {
                player = new IPlayer(sGUID, campType);
            }

            player.GameUserId = sGUID;
            return(player);
        }
Exemple #13
0
    public static Dictionary <UInt64, HeroBattleInfo> AllBlueHeroBattle = new Dictionary <UInt64, HeroBattleInfo>(); //蓝方阵营信息

    public string GetGUIDName(UInt64 icon, EntityCampTypeEnum camp)
    {
        if (EntityCampTypeEnum.A == (EntityCampTypeEnum)camp)
        {
            foreach (var battle in AllBlueHeroBattle)
            {
                if (icon == battle.Key)
                {
                    return(battle.Value.HeroName);
                }
            }
        }
        else
        {
            foreach (var battle in AllRedHeroBattle)
            {
                if (icon == battle.Key)
                {
                    return(battle.Value.HeroName);
                }
            }
        }
        return(null);
    }
Exemple #14
0
 public void SetInfoInit(UInt64 icon, string name, int level, int kills, int death, EntityCampTypeEnum camp, int campID)
 {
     if (GetBlueGuid(icon))
     {
         BattleInfo battle = new BattleInfo(icon, name, level, kills, death, EntityCampTypeEnum.A, campID);
         AllBlueTeam.Add(battle);
         SetLevelInfo(icon, level);
     }
 }
Exemple #15
0
 public IEntity(UInt64 sGUID, EntityCampTypeEnum campType)
 {
     GameObjGUID = sGUID;
     EntityCamp  = campType;
     m_pcGOSSI   = new CGameObjectSyncInfo();
 }
    public void SetScoreInfo(UInt64 key, string pszNickName, uint level, uint heroKills, uint deadTimes, EntityCampTypeEnum Type)
    {
        isStartTime = true;
        ShowScoreDate ssd = new ShowScoreDate(key, pszNickName, (int)level, (int)heroKills, (int)deadTimes, (int)Type);

        ListDate.Add(ssd);
    }
Exemple #17
0
 public IPlayer(UInt64 sGUID, EntityCampTypeEnum campType)
     : base(sGUID, campType)
 {
     BattleData = new PlayerBattleData();
 }
Exemple #18
0
 public void SetInfoInit(UInt64 icon, string name, int level, int kills, int death, EntityCampTypeEnum camp)
 {
     if (EntityCampTypeEnum.A == (EntityCampTypeEnum)camp && GetBlueGuid(icon))
     {
         BattleInfo battle = new BattleInfo(icon, name, level, kills, death, EntityCampTypeEnum.A);
         AllBlueTeam.Add(battle);
     }
     else if (EntityCampTypeEnum.B == (EntityCampTypeEnum)camp && GetRedGuid(icon))
     {
         BattleInfo battle = new BattleInfo(icon, name, level, kills, death, EntityCampTypeEnum.B);
         AllRedTeam.Add(battle);
     }
     SetLevelInfo(icon, level);
 }
    public void SetKillDeathPlayer(Byte killstate, int campID, UInt64 targetID, UInt64 killID, bool Aced, EHeroKillTitle Title)
    {
        MsgInfoManager.eKillMsgType m_type = (eKillMsgType)killstate;
        string             namekill        = null;
        string             readXml         = null;
        EntityCampTypeEnum Type            = (EntityCampTypeEnum)campID;
        string             namedead        = null;

        SetAuido(m_type, Aced);
        if (Type == EntityCampTypeEnum.Bad)
        {
            namekill = "中立势力";
            readXml  = ConfigReader.GetMsgInfo(10009).content;
            m_type   = MsgInfoManager.eKillMsgType.eKillBuild;
        }
        else
        {
            readXml = ConfigReader.GetMsgInfo(10008).content;
        }

        if ((int)campID % 2 == 0)
        {
            Type = EntityCampTypeEnum.B;
        }
        else
        {
            Type = EntityCampTypeEnum.A;
        }
        namedead = GetNameGame(targetID);
        if (namekill == null)
        {
            namekill = GetNameGame(killID);
        }
        if (namekill != null)
        {
            MsgInfoManager.Instance.SetAudioPlay(killID, AudioPlayType.TwentySconde);
        }
        else
        {
            if (Type == EntityCampTypeEnum.A)
            {
                namekill = "精灵势力";
            }
            else
            {
                namekill = "亡灵势力";
            }
            m_type = MsgInfoManager.eKillMsgType.eKillBuild;
        }
        if (namekill == null || namedead == null || readXml == null)
        {
            return;
        }
        if (Aced)
        {
            MsgInfoManager.Instance.SetKills(m_type, Aced, namekill, namedead, readXml, Title);
            Aced = false;
        }

        MsgInfoManager.Instance.SetKills(m_type, Aced, namekill, namedead, readXml, Title);
    }
Exemple #20
0
    public void AddInitPlayer(UInt64 sGUID, string name, int kills, int death, int Assist, int level, int lastHit, EntityCampTypeEnum type, int heroid)
    {
        HeroBattleInfo HeroBattle = null;
        Dictionary <UInt64, HeroBattleInfo> heroBattleDic = GetCamp(type);
        int id = heroid;
        HeroSelectConfigInfo info = ConfigReader.GetHeroSelectInfo(id);

        if (info == null)
        {
            Debug.LogError("HeroSeletCfg not Find heroId");
            return;
        }
        if (!heroBattleDic.TryGetValue(sGUID, out HeroBattle))
        {
            HeroBattle          = new HeroBattleInfo();
            HeroBattle.SGUID    = sGUID;
            HeroBattle.HeroName = name;
            HeroBattle.Level    = level;
            HeroBattle.Kills    = kills;
            HeroBattle.Deaths   = death;
            HeroBattle.Assist   = Assist;
            HeroBattle.HeadIcon = info.HeroSelectHead;
            HeroBattle.LastHit  = lastHit;
            HeroBattle.campType = type;
            SetDic(sGUID, HeroBattle);
            return;
        }
        HeroBattle.SGUID    = sGUID;
        HeroBattle.HeroName = name;
        HeroBattle.Level    = level;
        HeroBattle.Kills    = kills;
        HeroBattle.Deaths   = death;
        HeroBattle.Assist   = Assist;
        HeroBattle.HeadIcon = info.HeroSelectHead;
        HeroBattle.LastHit  = lastHit;
        HeroBattle.campType = type;
        SetDic(sGUID, HeroBattle);
    }
 //创建实体
 public virtual IEntity HandleCreateEntity(UInt64 sGUID, EntityCampTypeEnum campType)
 {
     return(new IEntity(sGUID, campType));
 }
        //showInfo
        public void SetSettlementInfo(UInt64 objGUID, int headID, string nickName, int kills, int death, int asstimes, int level, int totalcp, int lasthit, EntityCampTypeEnum camp)
        {
            SettlementData ssd = new SettlementData();

            ssd.Init(objGUID, headID, nickName, level, kills, death, asstimes, totalcp, lasthit, camp);
            mListMentDate.Add(ssd);
        }