Ejemplo n.º 1
0
        public GameEntity CreateBullet(ECampType campType, int bulletType, EColorType colorType = EColorType.Unknow)
        {
            int    bulletCode = 100 * bulletType + (int)colorType;
            string code       = EntityUtil.GetBulletCode(bulletCode);

            return(CreateBullet(campType, code));
        }
Ejemplo n.º 2
0
    /// <summary>
    /// 初始化神兽出生坐标,设置到这个格子坐标上然后初始化正方向
    /// </summary>
    /// <param name="unBeastId"></param>
    /// <param name="vec3Hex"></param>
    public void InitBeastPos(long unBeastId, CVector3 vec3Hex)
    {
        Beast beast = this.GetBeastById(unBeastId);

        if (beast != null)
        {
            beast.Move(vec3Hex);
            beast.SetVisible(true);
            Singleton <ClientMain> .singleton.scene.RoleSetToInitialPos(beast.Id, vec3Hex);

            ECampType eCampType = ECampType.CAMP_EMPIRE;
            if (eCampType == beast.eCampType)
            {
                eCampType = ECampType.CAMP_LEAGUE;
            }
            //取得和该神兽对立阵营的基地坐标
            CVector3 baseHexPos = Singleton <ClientMain> .singleton.scene.GetBasePos(eCampType);

            Vector3 baseHex3DPos = Hexagon.GetHex3DPos(baseHexPos, Space.World);
            Vector3 hex3DPos     = Hexagon.GetHex3DPos(vec3Hex, Space.World);
            Vector3 vector       = baseHex3DPos - hex3DPos;
            //然后得到神兽的正方向
            beast.Forward = new Vector2(vector.x, vector.z);
            //SkillManager.NotifyHeroPosChange(unHeroId);
        }
    }
Ejemplo n.º 3
0
 public CampData(uint unHp, ECampType eCampType)
 {
     this.m_unHp        = unHp;
     this.m_eCampType   = eCampType;
     this.m_unMoney     = 0u;
     this.m_unMaxHp     = 0u;
     this.m_eBaseStatus = EBaseStatus.BASE_STATUS_NORMAL;
 }
Ejemplo n.º 4
0
        public GameEntity CreateBullet(ECampType campType, string code)
        {
            var entity = CreateEntity(code);

            entity.bulletData.campType = campType;

            return(entity);
        }
Ejemplo n.º 5
0
 public BeastData(long playerId, long beastId, ECampType eCampType)
 {
     this.m_unPlayerId    = playerId;
     this.m_unBeastId     = beastId;
     this.m_eCamptype     = eCampType;
     this.m_unBeastTypeId = -1;
     this.m_nBeastLevel   = 0;
 }
Ejemplo n.º 6
0
 /// <summary>
 /// 刷新所有玩家的信息
 /// </summary>
 private void RefreshAllPlayerInfo()
 {
     if (base.Prepared)
     {
         this.SetPlayerInfoToList(base.uiBehaviour.m_ourBeastList, Singleton <RoomManager> .singleton.OurPlayerDatas, Singleton <PlayerRole> .singleton.CampType);
         ECampType eCampType = (Singleton <PlayerRole> .singleton.CampType == ECampType.CAMP_EMPIRE) ? ECampType.CAMP_LEAGUE : ECampType.CAMP_EMPIRE;
         this.SetPlayerInfoToList(base.uiBehaviour.m_enmeyBeastList, Singleton <RoomManager> .singleton.EnemyPlayerDatas, eCampType);
     }
 }
Ejemplo n.º 7
0
 public virtual void InitData(ChessData data, UChessBoard board)
 {
     this.name      = data.name;
     this.campType  = data.campType;
     this.point     = data.point;
     this.prefab    = data.prefab;
     this.chessType = data.chessType;
     _chessboard    = board;
 }
Ejemplo n.º 8
0
 //-------------------------------------------------------------------------
 // 胜负判定
 bool Judge(UChess EatedChess)
 {
     if (EatedChess.chessType == EChessType.Shuai)
     {
         Winner = EatedChess.campType == ECampType.Red ? ECampType.Black : ECampType.Red;
         return(true);
     }
     return(false);
 }
Ejemplo n.º 9
0
        /// <summary>
        /// 改变阵营的血量,然后根据血量判断是否播放不同的背景乐
        /// </summary>
        /// <param name="eCampType"></param>
        /// <param name="unHp"></param>
        public void OnCampHpChange(ECampType eCampType, uint unHp)
        {
            uint index = (uint)(eCampType - ECampType.CAMP_EMPIRE);

            if (index >= 0 && index < this.m_CampDatas.Length)
            {
                this.m_CampDatas[index].Hp = unHp;
            }
            //根据不同基地的血量播放不同的背景音乐
            this.PlayMusicByBaseHp();
        }
Ejemplo n.º 10
0
 //-------------------------------------------------------------------------
 // 将棋盘坐标转化为棋子坐标
 public Point ToChessPoint(Point pt, ECampType ct)
 {
     if (ct == ECampType.Red)
     {
         return(new Point(9 - pt.x, pt.y + 1));
     }
     else
     {
         return(new Point(9 - pt.x, pt.y + 1).Invert());
     }
 }
Ejemplo n.º 11
0
 //-------------------------------------------------------------------------
 // 将棋子坐标转为棋盘坐标(以红方为准,从左到右 0-8,从下到上0-9)
 public Point ToChessboardPoint(Point pt, ECampType ct)
 {
     if (ct == ECampType.Red)
     {
         return(new Point(9 - pt.x, pt.y - 1));
     }
     else
     {
         return(ToChessboardPoint(pt.Invert(), ECampType.Red));
     }
 }
Ejemplo n.º 12
0
    public Beast(BeastData beastData)
    {
        if (null == beastData)
        {
            this.m_bIsErrorBeast = true;
            this.m_skillManager  = new SkillGameManager(0);
        }
        else
        {
            this.m_bIsErrorBeast = false;
            DataBeastlist dataBeast = null;
            GameData <DataBeastlist> .dataMap.TryGetValue(beastData.BeastTypeId, out dataBeast);

            if (dataBeast != null)
            {
                this.MaxMoveDis = dataBeast.Move;
                this.Hp         = dataBeast.Hp;
                if (dataBeast.Skill_1 > 0)
                {
                    this.m_listBeastOriginActivedSkillID.Add(dataBeast.Skill_1);
                }
                if (dataBeast.Skill_2 > 0)
                {
                    this.m_listBeastOriginActivedSkillID.Add(dataBeast.Skill_2);
                }
                if (dataBeast.Skill_3 > 0)
                {
                    this.m_listBeastOriginActivedSkillID.Add(dataBeast.Skill_3);
                }
                if (dataBeast.Skill_4 > 0)
                {
                    this.m_listBeastOriginActivedSkillID.Add(dataBeast.Skill_4);
                }
            }
            else
            {
                this.m_log.Error(string.Format("null == beastConfig: beastData.BeastTypeId=:{0}", beastData.BeastTypeId));
            }
            this.m_unBeastId     = beastData.Id;
            this.m_unPlayerId    = beastData.PlayerId;
            this.m_dwBeastTypeId = beastData.BeastTypeId;
            this.m_eCampType     = beastData.CampType;
            this.m_unHp          = beastData.Hp;
            this.m_suitId        = beastData.SuitId;
            this.m_skillManager  = new SkillGameManager(this.m_unBeastId);
            this.m_skillManager.AddSkill(1, false);
            foreach (var skillData in beastData.Skills)
            {
                this.m_skillManager.AddSkill(skillData, false, ESkillActivateType.SKILL_ACTIVATE_TYPE_INVALID);
            }
        }
    }
Ejemplo n.º 13
0
    /// <summary>
    /// 取得基地的格子坐标
    /// </summary>
    /// <param name="nCamp"></param>
    /// <returns></returns>
    public CVector3 GetBasePos(ECampType nCamp)
    {
        CVector3 result;

        if (null == this.m_map)
        {
            result = null;
        }
        else
        {
            result = this.m_map.GetBasePos(nCamp);
        }
        return(result);
    }
Ejemplo n.º 14
0
 //-------------------------------------------------------------------------
 // 设置当前谁的回合
 void SetNowTun(ECampType NowCamp)
 {
     NowPlayer = NowCamp;
     if (NowPlayer == ECampType.Red)
     {
         BlackGamer.Controller.TunEnd();
         RedGamer.Controller.TunStart();
     }
     else
     {
         RedGamer.Controller.TunEnd();
         BlackGamer.Controller.TunStart();
     }
 }
Ejemplo n.º 15
0
    /// <summary>
    /// 取得顺序
    /// </summary>
    /// <param name="eCampType"></param>
    /// <param name="index"></param>
    /// <returns></returns>
    private int GetSequence(ECampType eCampType, int index)
    {
        int result = 0;

        switch (eCampType)
        {
        case ECampType.CAMP_EMPIRE:
            if (index == 0)
            {
                result = 1;
            }
            else
            {
                if (index == 1)
                {
                    result = 4;
                }
                else
                {
                    if (index == 2)
                    {
                        result = 5;
                    }
                }
            }
            break;

        case ECampType.CAMP_LEAGUE:
            if (index == 0)
            {
                result = 2;
            }
            else
            {
                if (index == 1)
                {
                    result = 3;
                }
                else
                {
                    if (index == 2)
                    {
                        result = 6;
                    }
                }
            }
            break;
        }
        return(result);
    }
Ejemplo n.º 16
0
        protected override void CopyData(BaseEvent src)
        {
            base.CopyData(src);
            CallMonsterTick tick = src as CallMonsterTick;

            this.TargetId        = tick.TargetId;
            this.WayPointId      = tick.WayPointId;
            this.ConfigID        = tick.ConfigID;
            this.LifeTime        = tick.LifeTime;
            this.CampType        = tick.CampType;
            this.Invincible      = tick.Invincible;
            this.Moveable        = tick.Moveable;
            this.bCopyedHeroInfo = tick.bCopyedHeroInfo;
        }
Ejemplo n.º 17
0
    public List <Beast> GetAllBeastByCamp(ECampType eCampType)
    {
        List <Beast>        list      = new List <Beast>();
        ICollection <Beast> allBeasts = this.GetAllBeasts();

        foreach (var beast in allBeasts)
        {
            if (beast.eCampType == eCampType)
            {
                list.Add(beast);
            }
        }
        return(list);
    }
Ejemplo n.º 18
0
        /// <summary>
        /// 取得谋反阵营的数据
        /// </summary>
        /// <param name="eCampType"></param>
        /// <returns></returns>
        public CampData GetCampData(ECampType eCampType)
        {
            int      num = (int)(eCampType - ECampType.CAMP_EMPIRE);
            CampData result;

            if (0 <= num && num < 2)
            {
                result = this.m_CampDatas[num];
            }
            else
            {
                result = default(CampData);
            }
            return(result);
        }
 public ERelationType GetRelation(ECampType playerCampType, ECampType targetCampType)
 {
     if (playerCampType == targetCampType)
     {
         return(ERelationType.Friendly);
     }
     else if (playerCampType == ECampType.Neutral || targetCampType == ECampType.Neutral)
     {
         return(ERelationType.Neutral);
     }
     else
     {
         return(ERelationType.Hostile);
     }
 }
Ejemplo n.º 20
0
 void OnGameOver(ECampType Winner)
 {
     if (UPlayer.LocalPlayer != null)
     {
         spriteGameOver.SetActive(true);
         if (Winner == UPlayer.LocalPlayer.Camp)
         {
             labelWinner.text = "你赢了";
         }
         else
         {
             labelWinner.text = "你输了";
         }
     }
 }
Ejemplo n.º 21
0
    public Command Update(UChess[] inputs, ECampType NowCamp)
    {
        List <Command> CmdList = GetCommandList(inputs, NowCamp);

        if (CmdList.Count == 0)
        {
            return(null);
        }

        double[] outputs = Update(GetInputs(inputs, NowCamp));
        int      index   = Mathf.FloorToInt((float)(outputs[0] * CmdList.Count));

        index = Mathf.Clamp(index, 0, CmdList.Count - 1);
        return(CmdList[index]);
    }
Ejemplo n.º 22
0
    double[] GetInputs(UChess[] inputs, ECampType NowCamp)
    {
        double[] outputs = new double[Config.NumInputs];

        int output_index = 0;

        for (int i = 0; i < inputs.Length; i++)
        {
            outputs[output_index++] = inputs[i].point.x;
            outputs[output_index++] = inputs[i].point.y;
            outputs[output_index++] = (double)inputs[i].campType;
        }

        return(outputs);
    }
Ejemplo n.º 23
0
        /// <summary>
        /// 根据阵营类型获取基地高血量的特效,如果阵营不存在就放回0
        /// </summary>
        /// <param name="campType">阵营类型</param>
        /// <returns></returns>
        public int GetBaseHighHpEffect(ECampType campType)
        {
            int result;

            if (campType == ECampType.CAMP_EMPIRE)
            {
                result = this.m_nEmpireHighHpEffect;
            }
            else if (campType == ECampType.CAMP_LEAGUE)
            {
                result = this.m_nLeagueHighHpEffect;
            }
            else
            {
                result = 0;
            }
            return(result);
        }
        protected override void CopyData(BaseEvent src)
        {
            base.CopyData(src);
            CallMonsterTick callMonsterTick = src as CallMonsterTick;

            this.TargetId                   = callMonsterTick.TargetId;
            this.WayPointId                 = callMonsterTick.WayPointId;
            this.ConfigID                   = callMonsterTick.ConfigID;
            this.LifeTime                   = callMonsterTick.LifeTime;
            this.CampType                   = callMonsterTick.CampType;
            this.Invincible                 = callMonsterTick.Invincible;
            this.Moveable                   = callMonsterTick.Moveable;
            this.bCopyedHeroInfo            = callMonsterTick.bCopyedHeroInfo;
            this.bSuicideWhenHostDead       = callMonsterTick.bSuicideWhenHostDead;
            this.bDrageToHostWhenTooFarAway = callMonsterTick.bDrageToHostWhenTooFarAway;
            this.bUseHostValueProperty      = callMonsterTick.bUseHostValueProperty;
            this.bInitialVisibility         = callMonsterTick.bInitialVisibility;
        }
Ejemplo n.º 25
0
    List <Command> GetCommandList(UChess[] inputs, ECampType NowCamp)
    {
        List <Command> R = new List <Command>();

        for (int i = 0; i < inputs.Length; i++)
        {
            if (inputs[i].campType == NowCamp)
            {
                List <Point> Targets = inputs[i].GetAvailablePoints();
                for (int j = 0; j < Targets.Count; j++)
                {
                    Command Cmd = new Command();
                    Cmd.Camp = NowCamp;
                    Cmd.From = inputs[i].ToChessboardPoint();
                    Cmd.To   = inputs[i].chessboard.ToChessboardPoint(Targets[j], NowCamp);
                    R.Add(Cmd);
                }
            }
        }
        return(R);
    }
Ejemplo n.º 26
0
    public CVector3 GetBasePos(ECampType nCamp)
    {
        CVector3 result;

        if (nCamp == ECampType.CAMP_EMPIRE)
        {
            result = this.m_oMapData.empireMapNode;
        }
        else
        {
            if (nCamp == ECampType.CAMP_LEAGUE)
            {
                result = this.m_oMapData.leagueMapNode;
            }
            else
            {
                result = null;
            }
        }
        return(result);
    }
Ejemplo n.º 27
0
    public Player(PlayerData playerData)
    {
        if (null != playerData)
        {
            this.m_bIsErrorPlayer = false;
            this.m_unPlayerId     = playerData.PlayerId;
            this.m_eCampType      = playerData.CampType;
            this.m_strPlayerName  = playerData.Name;
            this.m_bIsLostConnect = playerData.IsReconnect;
            this.m_bIsRole        = (Singleton <PlayerRole> .singleton.ID == this.m_unPlayerId);
            this.m_listBeastId.Clear();
            for (int i = 0; i < playerData.Beasts.Count; i++)
            {
                BeastData beastData = playerData.Beasts[i];
                this.m_listBeastId.Add(beastData.Id);
                Beast beast = Singleton <BeastManager> .singleton.CreateBeast(beastData);

                if (null != beast)
                {
                }
            }
        }
    }
Ejemplo n.º 28
0
 /// <summary>
 /// 我方和敌方的选择神兽列表刷新
 /// </summary>
 /// <param name="uiList"></param>
 /// <param name="listPlayerData"></param>
 /// <param name="eCampType"></param>
 private void SetPlayerInfoToList(IXUIList uiList, List <PlayerData> listPlayerData, ECampType eCampType)
 {
     if (uiList != null)
     {
         for (int i = 0; i < uiList.Count; i++)
         {
             IXUIListItem item = uiList.GetItemByIndex(i);
             if (item != null)
             {
                 item.Clear();
                 IXUIList equip = item.GetUIObject("List_Equip") as IXUIList;
                 if (equip != null)
                 {
                     for (int j = 0; j < equip.Count; j++)
                     {
                         IXUIListItem equipItem = equip.GetItemByIndex(j);
                         if (equipItem != null)
                         {
                             equipItem.Clear();//清空装备icon
                         }
                     }
                 }
                 IXUIObject uiObject = item.GetUIObject("Texture_Shadow") as IXUIObject;
                 if (uiObject != null)
                 {
                     uiObject.SetVisible(true);
                 }
                 item.SetText("Label_Sequence", "");
             }
         }
         int num = 0;
         foreach (var playerData in listPlayerData)
         {
             foreach (var beastData in playerData.Beasts)
             {
                 IXUIListItem item = (num >= uiList.Count) ? null : uiList.GetItemByIndex(num);
                 if (item != null)
                 {
                     this.RefreshPlayerInfo(item, playerData, beastData, eCampType);
                 }
                 num++;
             }
         }
         Debug.Log("Beast num=" + num);
     }
 }
Ejemplo n.º 29
0
 private void RefreshPlayerInfo(IXUIListItem uiListItem, PlayerData playerData, BeastData beast, ECampType eCampType)
 {
     if (beast != null)
     {
         this.SetSelectBeastId(beast.Id, beast.BeastTypeId);
         Debug.Log("Our BeastId:" + beast.Id);
         if (playerData != null && uiListItem != null)
         {
             uiListItem.Clear();
             IXUILabel label = uiListItem.GetUIObject("Label_PlayerName") as IXUILabel;
             if (label != null)
             {
                 label.SetText(playerData.Name);
             }
             if (Singleton <RoomManager> .singleton.MathMode != EnumMathMode.EnumMathMode_Story)
             {
                 uiListItem.SetText("Label_Sequence", GetSequence(eCampType, uiListItem.Index).ToString());
             }
             this.RefreshPlayerInfo(uiListItem, beast);
         }
     }
 }
Ejemplo n.º 30
0
 //-------------------------------------------------------------------------
 public void SetPlayerView(ECampType ct)
 {
     CameraRed.SetActive(ct == ECampType.Red);
     CameraBlack.SetActive(ct == ECampType.Black);
 }